Extract version command to common location

This commit is contained in:
Ethan Frey
2018-03-01 02:30:13 +00:00
committed by rigelrozanski
parent d1fc3d6801
commit a99d913982
4 changed files with 9 additions and 34 deletions
+24
View File
@@ -0,0 +1,24 @@
package version
import (
"fmt"
"github.com/spf13/cobra"
)
var (
// VersionCmd prints out the current sdk version
VersionCmd = &cobra.Command{
Use: "version",
Short: "Print the app version",
Run: doVersionCmd,
}
)
func doVersionCmd(cmd *cobra.Command, args []string) {
v := Version
if GitCommit != "" {
v = v + " " + GitCommit
}
fmt.Println(v)
}