Implement version in chub

This commit is contained in:
Ethan Frey 2018-01-18 12:38:25 +01:00 committed by Ethan Buchman
parent 9aa3189738
commit 2cd22b45bb
1 changed files with 16 additions and 2 deletions

View File

@ -1,11 +1,25 @@
package main
import "github.com/spf13/cobra"
import (
"fmt"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/version"
)
var (
versionCmd = &cobra.Command{
Use: "version",
Short: "Print the app version",
RunE: todoNotImplemented,
Run: doVersionCmd,
}
)
func doVersionCmd(cmd *cobra.Command, args []string) {
v := version.Version
if version.GitCommit != "" {
v = v + " " + version.GitCommit
}
fmt.Println(v)
}