File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ const (
2525
2626func NewRootCmd () * cobra.Command {
2727 cmd := & cobra.Command {
28- Use : "./ keystore <command> " ,
28+ Use : "keystore" ,
2929 Long : `
3030CLI for managing keystore keys. Must specify KEYSTORE_FILE_PATH or KEYSTORE_DB_URL
3131and KEYSTORE_PASSWORD in order to load the keystore.
@@ -336,16 +336,18 @@ func NewDecryptCmd() *cobra.Command {
336336}
337337
338338func loadKeystore (ctx context.Context , cmd * cobra.Command ) (ks.Keystore , error ) {
339- root := cmd .Root ()
340- filePath , err := root .Flags ().GetString ("keystore-file-path" )
339+ // Use parent command which has the persistent flags.
340+ // This works whether keystore CLI is standalone or embedded as a subcommand.
341+ parent := cmd .Parent ()
342+ filePath , err := parent .Flags ().GetString ("keystore-file-path" )
341343 if err != nil {
342344 return nil , err
343345 }
344- dbURL , err := root .Flags ().GetString ("keystore-db-url" )
346+ dbURL , err := parent .Flags ().GetString ("keystore-db-url" )
345347 if err != nil {
346348 return nil , err
347349 }
348- password , err := cmd .Flags ().GetString ("keystore-password" )
350+ password , err := parent .Flags ().GetString ("keystore-password" )
349351 if err != nil {
350352 return nil , err
351353 }
You can’t perform that action at this time.
0 commit comments