Skip to content

Commit

Permalink
fix: added key when dry-run is true
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanchristo committed Jun 8, 2021
1 parent 98cf72c commit 206c0bf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions client/keys/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func runAddCmdPrepare(cmd *cobra.Command, args []string) error {
return err
}

return RunAddCmd(clientCtx, cmd, args, buf)
return runAddCmd(clientCtx, cmd, args, buf)
}

/*
Expand All @@ -100,7 +100,7 @@ input
output
- armor encrypted private key (saved to file)
*/
func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *bufio.Reader) error {
func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *bufio.Reader) error {
var err error

name := args[0]
Expand Down Expand Up @@ -268,6 +268,13 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
return err
}

if dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun); dryRun {
err = kb.Delete(name)
if err != nil {
return err
}
}

// Recover key from seed passphrase
if recover {
// Hide mnemonic from output
Expand Down

0 comments on commit 206c0bf

Please sign in to comment.