Skip to content

Commit

Permalink
feat: version command
Browse files Browse the repository at this point in the history
  • Loading branch information
anarcher committed Apr 29, 2021
1 parent 5bf81d2 commit b4dd299
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ func main() {
restartCmd := cmd.NewRestartCmd(cfg)
drainCmd := cmd.NewDrainCmd(cfg)
showCmd := cmd.NewShowCmd(cfg)
versionCmd := cmd.NewVersionCmd()

rootCmd.Subcommands = []*ffcli.Command{
restartCmd,
drainCmd,
showCmd,
versionCmd,
}

if err := rootCmd.Parse(os.Args[1:]); err != nil {
Expand Down
23 changes: 23 additions & 0 deletions pkg/cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"context"
"fmt"

"github.com/peterbourgon/ff/v3/ffcli"
)

const Version = "v0.0.5"

func NewVersionCmd() *ffcli.Command {
c := &ffcli.Command{
Name: "version",
ShortUsage: "show version of kroller",
ShortHelp: "show version of kroller",
Exec: func(context.Context, []string) error {
fmt.Printf("version: %s\n", Version)
return nil
},
}
return c
}

0 comments on commit b4dd299

Please sign in to comment.