forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cosmos#21726): Add NewShowUpgradeInfoCmd command
- Loading branch information
Bastien Rigaud
committed
Sep 25, 2024
1 parent
3856e77
commit dd7929d
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewShowUpgradeInfoCmd() *cobra.Command { | ||
showUpgradeInfo := &cobra.Command{ | ||
Use: "show-upgrade-info <path to executable>", | ||
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 | ||
} |