Extract version command to common location
This commit is contained in:
parent
d1fc3d6801
commit
a99d913982
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
}
|
||||
@ -1,11 +1,9 @@
|
||||
package main
|
||||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -18,9 +16,9 @@ var (
|
||||
)
|
||||
|
||||
func doVersionCmd(cmd *cobra.Command, args []string) {
|
||||
v := version.Version
|
||||
if version.GitCommit != "" {
|
||||
v = v + " " + version.GitCommit
|
||||
v := Version
|
||||
if GitCommit != "" {
|
||||
v = v + " " + GitCommit
|
||||
}
|
||||
fmt.Println(v)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user