From 98ed3977457e4ce6ebe7010eee177753d42b8bc1 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 7 Sep 2022 14:55:36 +0200 Subject: [PATCH] cmd: print all versions of tendermint and its sub protocols (#9329) (#9386) --- cmd/tendermint/commands/version.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cmd/tendermint/commands/version.go b/cmd/tendermint/commands/version.go index d1a7fba58..d33a7c3a3 100644 --- a/cmd/tendermint/commands/version.go +++ b/cmd/tendermint/commands/version.go @@ -1,6 +1,7 @@ package commands import ( + "encoding/json" "fmt" "github.com/spf13/cobra" @@ -13,6 +14,25 @@ var VersionCmd = &cobra.Command{ Use: "version", Short: "Show version info", Run: func(cmd *cobra.Command, args []string) { - fmt.Println(version.TMCoreSemVer) + if verbose { + values, _ := json.MarshalIndent(struct { + Tendermint string `json:"tendermint"` + ABCI string `json:"abci"` + BlockProtocol uint64 `json:"block_protocol"` + P2PProtocol uint64 `json:"p2p_protocol"` + }{ + Tendermint: version.TMCoreSemVer, + ABCI: version.ABCIVersion, + BlockProtocol: version.BlockProtocol, + P2PProtocol: version.P2PProtocol, + }, "", " ") + fmt.Println(string(values)) + } else { + fmt.Println(version.TMCoreSemVer) + } }, } + +func init() { + VersionCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Show protocol and library versions") +}