package cmd import ( "log" "runtime" "github.com/spf13/cobra" ) var ( version string ) // initializes the sub-command func init() { rootCmd.AddCommand(versionCmd) } var versionCmd = &cobra.Command{ Use: "version", Short: "Display version info.", Long: `In case you're curious, run this command to find out the version info.`, Run: func(cmd *cobra.Command, args []string) { log.Printf("Adept version %s", version) log.Printf("Built with Go %s", runtime.Version()) log.Printf("View source at https://git.metaunix.net/BitGoblin/adept") }, }