diff --git a/main.go b/main.go index 177b2de..ab3b2a9 100644 --- a/main.go +++ b/main.go @@ -21,6 +21,9 @@ func main() { "client state": func() (cli.Command, error) { return &ClientStateCommand{}, nil }, + "version": func() (cli.Command, error) { + return &VersionCommand{}, nil + }, } cli := &cli.CLI{ Name: "nomad-debug", diff --git a/version.go b/version.go new file mode 100644 index 0000000..dde599c --- /dev/null +++ b/version.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "strings" + + "github.com/hashicorp/nomad/version" +) + +type VersionCommand struct{} + +func (a *VersionCommand) Help() string { + helpText := ` +Usage: nomad-debug version + + Emits version infromation about the nomad-debug command. +` + + return strings.TrimSpace(helpText) +} + +func (a *VersionCommand) Name() string { return "version" } + +func (a *VersionCommand) Synopsis() string { + return "output nomad-debug version" +} + +func (a *VersionCommand) Run(args []string) int { + fmt.Printf("nomad-debug built with %s\n", version.GetVersion().FullVersionNumber(true)) + return 0 +}