32 lines
587 B
Go
32 lines
587 B
Go
package main
|
|
|
|
import (
|
|
"github.com/urfave/cli/v2" // imports as package "cli"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
app := &cli.App{
|
|
Name: "mythic",
|
|
Usage: "generate mythic results",
|
|
Commands: []*cli.Command{
|
|
{
|
|
Name: "init",
|
|
Usage: "Initialize a new game in Mythic",
|
|
Flags: []cli.Flag{
|
|
&cli.StringFlag{Name: "name", Usage: "the name of your new game"},
|
|
},
|
|
Action: func(ctx *cli.Context) error {
|
|
name := ctx.String("name")
|
|
_, err := NewRepository(name)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
},
|
|
},
|
|
},
|
|
}
|
|
app.Run(os.Args)
|
|
}
|