added archive, megamillions, and powerball site logic
This commit is contained in:
60
sites/megamillions/cmd/megamillions.go
Normal file
60
sites/megamillions/cmd/megamillions.go
Normal file
@@ -0,0 +1,60 @@
|
||||
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/megamillions"
|
||||
)
|
||||
|
||||
type MegaMillionsFlags []cli.Flag
|
||||
|
||||
var Flags = MegaMillionsFlags{}
|
||||
|
||||
func (f MegaMillionsFlags) ToConfig(_ *cli.Command) megamillions.Config {
|
||||
c := megamillions.DefaultConfig
|
||||
return c
|
||||
}
|
||||
|
||||
func main() {
|
||||
var flags []cli.Flag
|
||||
|
||||
flags = append(flags, browser.Flags...)
|
||||
flags = append(flags, Flags...)
|
||||
|
||||
cli := &cli.Command{
|
||||
Name: "megamillions",
|
||||
Usage: "Get MegaMillions 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)
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user