NewCmdVersion prints out the release version info for this command binary. It is used as a subcommand of a parent command.
(parentCommand string)
| 19 | // NewCmdVersion prints out the release version info for this command binary. |
| 20 | // It is used as a subcommand of a parent command. |
| 21 | func NewCmdVersion(parentCommand string) *cobra.Command { |
| 22 | cmd := &cobra.Command{ |
| 23 | Use: "version", |
| 24 | Short: versionShort, |
| 25 | Long: versionLong, |
| 26 | Example: fmt.Sprintf(versionExample, parentCommand, parentCommand), |
| 27 | Run: func(cmd *cobra.Command, args []string) { |
| 28 | fmt.Fprintf(os.Stdout, "%s version: %s\n", parentCommand, version.Get()) |
| 29 | }, |
| 30 | } |
| 31 | |
| 32 | return cmd |
| 33 | } |