diff --git a/tools/cosmovisor/cmd/cosmovisor/root.go b/tools/cosmovisor/cmd/cosmovisor/root.go index d9f6094d593c..d8c351f4c143 100644 --- a/tools/cosmovisor/cmd/cosmovisor/root.go +++ b/tools/cosmovisor/cmd/cosmovisor/root.go @@ -19,6 +19,7 @@ func NewRootCmd() *cobra.Command { configCmd, NewVersionCmd(), NewAddUpgradeCmd(), + NewShowUpgradeInfoCmd(), ) rootCmd.PersistentFlags().StringP(cosmovisor.FlagCosmovisorConfig, "c", "", "path to cosmovisor config file") diff --git a/tools/cosmovisor/cmd/cosmovisor/show_upgrade.go b/tools/cosmovisor/cmd/cosmovisor/show_upgrade.go new file mode 100644 index 000000000000..3a604afde5d5 --- /dev/null +++ b/tools/cosmovisor/cmd/cosmovisor/show_upgrade.go @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" +) + +func NewShowUpgradeInfoCmd() *cobra.Command { + showUpgradeInfo := &cobra.Command{ + Use: "show-upgrade-info ", + Short: "Show upgrade-info.json into stdout.", + SilenceUsage: true, + RunE: showUpgradeInfoCmd, + } + + return showUpgradeInfo +} + +func showUpgradeInfoCmd(cmd *cobra.Command, path string) error { + data, err := os.ReadFile(path) + if err != nil { + return fmt.Errorf("failed to read upgrade-info.json: %w", err) + } + + fmt.Println(string(data)) + + return nil +}