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
+3 -1
View File
@@ -7,6 +7,8 @@ import (
"github.com/spf13/cobra"
"github.com/tendermint/tmlibs/cli"
"github.com/cosmos/cosmos-sdk/version"
)
const (
@@ -66,7 +68,7 @@ func main() {
serveCommand(),
KeyCommands(),
lineBreak,
VersionCmd,
version.VersionCmd,
)
// prepare and add flags
-26
View File
@@ -1,26 +0,0 @@
package main
import (
"fmt"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/version"
)
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.Version
if version.GitCommit != "" {
v = v + " " + version.GitCommit
}
fmt.Println(v)
}
+2 -1
View File
@@ -9,6 +9,7 @@ import (
"github.com/tendermint/tmlibs/cli"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/version"
)
const (
@@ -35,7 +36,7 @@ func main() {
AddNodeCommands(gaiadCmd, node)
gaiadCmd.AddCommand(
VersionCmd,
version.VersionCmd,
)
// prepare and add flags
-26
View File
@@ -1,26 +0,0 @@
package main
import (
"fmt"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/version"
)
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.Version
if version.GitCommit != "" {
v = v + " " + version.GitCommit
}
fmt.Println(v)
}