Browse Source

add version cmd (Refs #124)

pull/1780/head
Anton Kaliaev 7 years ago
parent
commit
ecb1f02f77
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 16 additions and 2 deletions
  1. +16
    -2
      cmd/abci-cli/abci-cli.go

+ 16
- 2
cmd/abci-cli/abci-cli.go View File

@ -15,6 +15,7 @@ import (
"github.com/tendermint/abci/example/dummy"
"github.com/tendermint/abci/server"
"github.com/tendermint/abci/types"
"github.com/tendermint/abci/version"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
@ -71,8 +72,9 @@ var RootCmd = &cobra.Command{
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
switch cmd.Use {
// for the examples apps, don't pre-run
case "counter", "dummy":
case "counter", "dummy": // for the examples apps, don't pre-run
return nil
case "version": // skip running for version command
return nil
}
@ -130,6 +132,7 @@ func addCommands() {
RootCmd.AddCommand(deliverTxCmd)
RootCmd.AddCommand(checkTxCmd)
RootCmd.AddCommand(commitCmd)
RootCmd.AddCommand(versionCmd)
addQueryFlags()
RootCmd.AddCommand(queryCmd)
@ -219,6 +222,17 @@ var commitCmd = &cobra.Command{
},
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print abci console version",
Long: "",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println(version.Version)
return nil
},
}
var queryCmd = &cobra.Command{
Use: "query",
Short: "Query the application state",


Loading…
Cancel
Save