github.com/Oyster-zx/tendermint@v0.34.24-fork/cmd/tendermint/commands/version.go (about) 1 package commands 2 3 import ( 4 "encoding/json" 5 "fmt" 6 7 "github.com/spf13/cobra" 8 9 "github.com/tendermint/tendermint/version" 10 ) 11 12 // VersionCmd ... 13 var VersionCmd = &cobra.Command{ 14 Use: "version", 15 Short: "Show version info", 16 Run: func(cmd *cobra.Command, args []string) { 17 if verbose { 18 values, _ := json.MarshalIndent(struct { 19 Tendermint string `json:"tendermint"` 20 ABCI string `json:"abci"` 21 BlockProtocol uint64 `json:"block_protocol"` 22 P2PProtocol uint64 `json:"p2p_protocol"` 23 }{ 24 Tendermint: version.TMCoreSemVer, 25 ABCI: version.ABCIVersion, 26 BlockProtocol: version.BlockProtocol, 27 P2PProtocol: version.P2PProtocol, 28 }, "", " ") 29 fmt.Println(string(values)) 30 } else { 31 fmt.Println(version.TMCoreSemVer) 32 } 33 }, 34 } 35 36 func init() { 37 VersionCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Show protocol and library versions") 38 }