Skip to content

Commit aae5ef2

Browse files
authored
added -v flag to algokey (#4004)
1 parent 8455403 commit aae5ef2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/algokey/main.go

+9
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,21 @@ import (
2222

2323
"github.com/spf13/cobra"
2424
"github.com/spf13/cobra/doc"
25+
26+
"github.com/algorand/go-algorand/config"
2527
)
2628

29+
var versionCheck bool
30+
2731
var rootCmd = &cobra.Command{
2832
Use: "algokey",
2933
Short: "CLI for managing Algorand keys",
3034
Args: cobra.NoArgs,
3135
Run: func(cmd *cobra.Command, args []string) {
36+
if versionCheck {
37+
fmt.Println(config.FormatVersionAndLicense())
38+
return
39+
}
3240
// If no arguments passed, we should fallback to help
3341
cmd.HelpFunc()(cmd, args)
3442
},
@@ -41,6 +49,7 @@ func init() {
4149
rootCmd.AddCommand(signCmd)
4250
rootCmd.AddCommand(multisigCmd)
4351
rootCmd.AddCommand(partCmd)
52+
rootCmd.Flags().BoolVarP(&versionCheck, "version", "v", false, "Display and write current build version and exit")
4453
}
4554

4655
func main() {

0 commit comments

Comments
 (0)