this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

update automod helper to cli/v3

+11 -9
+11 -9
automod/keyword/cmd/kw-cli/main.go
··· 10 10 "github.com/bluesky-social/indigo/automod/keyword" 11 11 "github.com/bluesky-social/indigo/automod/setstore" 12 12 13 - "github.com/urfave/cli/v2" 13 + "github.com/urfave/cli/v3" 14 14 ) 15 15 16 16 func main() { 17 - app := cli.App{ 17 + app := cli.Command{ 18 18 Name: "kw-cli", 19 19 Usage: "informal debugging CLI tool for keyword matching", 20 20 } ··· 48 48 } 49 49 h := slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug}) 50 50 slog.SetDefault(slog.New(h)) 51 - app.RunAndExitOnError() 51 + if err := app.Run(context.Background(), os.Args); err != nil { 52 + slog.Error("command failed", "error", err) 53 + os.Exit(-1) 54 + } 52 55 } 53 56 54 - func runFuzzy(cctx *cli.Context) error { 57 + func runFuzzy(ctx context.Context, cmd *cli.Command) error { 55 58 scanner := bufio.NewScanner(os.Stdin) 56 59 for scanner.Scan() { 57 60 line := scanner.Text() ··· 63 66 return nil 64 67 } 65 68 66 - func runTokens(cctx *cli.Context) error { 67 - ctx := context.Background() 69 + func runTokens(ctx context.Context, cmd *cli.Command) error { 68 70 sets := setstore.NewMemSetStore() 69 - if err := sets.LoadFromFileJSON(cctx.String("json-set-file")); err != nil { 71 + if err := sets.LoadFromFileJSON(cmd.String("json-set-file")); err != nil { 70 72 return err 71 73 } 72 - setName := cctx.String("set-name") 73 - identMode := cctx.Bool("identifiers") 74 + setName := cmd.String("set-name") 75 + identMode := cmd.Bool("identifiers") 74 76 scanner := bufio.NewScanner(os.Stdin) 75 77 for scanner.Scan() { 76 78 line := scanner.Text()