mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-03 22:51:37 +00:00
add version cmd (Refs #124)
This commit is contained in:
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/dummy"
|
||||||
"github.com/tendermint/abci/server"
|
"github.com/tendermint/abci/server"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
|
"github.com/tendermint/abci/version"
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tmlibs/log"
|
||||||
|
|
||||||
@ -71,8 +72,9 @@ var RootCmd = &cobra.Command{
|
|||||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
switch cmd.Use {
|
switch cmd.Use {
|
||||||
// for the examples apps, don't pre-run
|
case "counter", "dummy": // for the examples apps, don't pre-run
|
||||||
case "counter", "dummy":
|
return nil
|
||||||
|
case "version": // skip running for version command
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +132,7 @@ func addCommands() {
|
|||||||
RootCmd.AddCommand(deliverTxCmd)
|
RootCmd.AddCommand(deliverTxCmd)
|
||||||
RootCmd.AddCommand(checkTxCmd)
|
RootCmd.AddCommand(checkTxCmd)
|
||||||
RootCmd.AddCommand(commitCmd)
|
RootCmd.AddCommand(commitCmd)
|
||||||
|
RootCmd.AddCommand(versionCmd)
|
||||||
addQueryFlags()
|
addQueryFlags()
|
||||||
RootCmd.AddCommand(queryCmd)
|
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{
|
var queryCmd = &cobra.Command{
|
||||||
Use: "query",
|
Use: "query",
|
||||||
Short: "Query the application state",
|
Short: "Query the application state",
|
||||||
|
Reference in New Issue
Block a user