1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package cmd
import (
"fmt"
"runtime"
"github.com/spf13/cobra"
)
func init() {
versionCmd := &cobra.Command{
Use: "version",
Short: "Print the rickub CLI version",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, _ []string) {
fmt.Fprintf(cmd.OutOrStdout(), "rickub %s (%s/%s)\n", Version, runtime.GOOS, runtime.GOARCH)
},
}
rootCmd.AddCommand(versionCmd)
rootCmd.Version = Version
}
|