Skip to content

Commit 206c0bf

Browse files
committed
fix: added key when dry-run is true
1 parent 98cf72c commit 206c0bf

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

client/keys/add.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func runAddCmdPrepare(cmd *cobra.Command, args []string) error {
8888
return err
8989
}
9090

91-
return RunAddCmd(clientCtx, cmd, args, buf)
91+
return runAddCmd(clientCtx, cmd, args, buf)
9292
}
9393

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

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

271+
if dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun); dryRun {
272+
err = kb.Delete(name)
273+
if err != nil {
274+
return err
275+
}
276+
}
277+
271278
// Recover key from seed passphrase
272279
if recover {
273280
// Hide mnemonic from output

0 commit comments

Comments
 (0)