6e41a56a7d
Change-Id: I5c8c524c4d3f569b21b5b829722b3c49952cb0ab
31 lines
680 B
Go
31 lines
680 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"opendev.org/airship/airshipctl/pkg/util"
|
|
)
|
|
|
|
// NewVersionCommand prints out the versions of airshipctl and its underlying tools
|
|
func NewVersionCommand() *cobra.Command {
|
|
versionCmd := &cobra.Command{
|
|
Use: "version",
|
|
Short: "Show the version number of airshipctl",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
out := cmd.OutOrStdout()
|
|
clientV := clientVersion()
|
|
w := util.NewTabWriter(out)
|
|
defer w.Flush()
|
|
fmt.Fprintf(w, "%s:\t%s\n", "airshipctl", clientV)
|
|
},
|
|
}
|
|
return versionCmd
|
|
}
|
|
|
|
func clientVersion() string {
|
|
// TODO(howell): There's gotta be a smarter way to do this
|
|
return "v0.1.0"
|
|
}
|