grim/wasdead

e3445e602139
Parents 13edf213332c
Children 290c54cfd71a
Add a version command and some more stuff to the usage screen
  • +17 -2
    main.go
  • --- a/main.go Fri May 10 23:16:01 2019 -0500
    +++ b/main.go Fri May 10 23:23:35 2019 -0500
    @@ -1,6 +1,8 @@
    package main
    import (
    + "fmt"
    +
    "github.com/alecthomas/kong"
    "bitbucket.org/TheToyz/nowdead/run"
    @@ -10,13 +12,26 @@
    version = "0.1.0"
    )
    +type versionCmd struct{}
    +
    +func (c *versionCmd) Run() error {
    + fmt.Printf("wasdead v%s\n", version)
    + return nil
    +}
    +
    type cli struct {
    - Run run.RunCmd `kong:"cmd,help='Run the bot'"`
    + Run run.RunCmd `kong:"cmd,help='Run the bot'"`
    + Version versionCmd `kong:"cmd,help='Display the version of this program'"`
    }
    func main() {
    cli := cli{}
    - ctx := kong.Parse(&cli)
    + ctx := kong.Parse(
    + &cli,
    + kong.Name("wasdead"),
    + kong.Description("A live stream announcement bot for discord"),
    + kong.UsageOnError(),
    + )
    err := ctx.Run()
    ctx.FatalIfErrorf(err)