rickub/clipublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/rickub/cli.git
git clone ssh://git@rickub.com/rickub/cli.git
version.go · 21 lines · 410 BGo Blame HistoryRaw
Initial import of the rickub CLI as a standalone public project 1a1d430 Olivier Girardot 9h ago1package cmd
2
3import (
4 "fmt"
5 "runtime"
6
7 "github.com/spf13/cobra"
8)
9
10func init() {
11 versionCmd := &cobra.Command{
12 Use: "version",
13 Short: "Print the rickub CLI version",
14 Args: cobra.NoArgs,
15 Run: func(cmd *cobra.Command, _ []string) {
16 fmt.Fprintf(cmd.OutOrStdout(), "rickub %s (%s/%s)\n", Version, runtime.GOOS, runtime.GOARCH)
17 },
18 }
19 rootCmd.AddCommand(versionCmd)
20 rootCmd.Version = Version
21}