package main import ( "context" "fmt" "os" "github.com/urfave/cli/v3" "gitea.stevedudenhoeffer.com/steve/go-extractor/cmd/browser/pkg/browser" "gitea.stevedudenhoeffer.com/steve/go-extractor/sites/powerball" ) type PowerballFlags []cli.Flag var Flags = PowerballFlags{} func (f PowerballFlags) ToConfig(_ *cli.Command) powerball.Config { c := powerball.DefaultConfig return c } func main() { var flags []cli.Flag flags = append(flags, browser.Flags...) flags = append(flags, Flags...) cli := &cli.Command{ Name: "powerball", Usage: "Get Powerball information", Flags: flags, Action: func(ctx context.Context, cli *cli.Command) error { b, err := browser.FromCommand(ctx, cli) if err != nil { return err } draw, next, err := Flags.ToConfig(cli).GetCurrent(ctx, b) if err != nil { return err } fmt.Printf("Drawing: %+v\n", draw) fmt.Printf("Next Drawing: %+v\n", next) return nil }, } err := cli.Run(context.Background(), os.Args) if err != nil { panic(err) } }