package cmd import ( "fmt" "runtime" "github.com/spf13/cobra" ) var ( Version = "dev" Commit = "none" Date = "unknown" ) var versionCmd = &cobra.Command{ Use: "version", Short: "Show version/build info", Run: func(cmd *cobra.Command, args []string) { fmt.Printf("snitch %s\n", Version) fmt.Printf(" commit: %s\n", Commit) fmt.Printf(" built: %s\n", Date) fmt.Printf(" go: %s\n", runtime.Version()) fmt.Printf(" os: %s/%s\n", runtime.GOOS, runtime.GOARCH) }, } func init() { rootCmd.AddCommand(versionCmd) }