Skip to content

Commit 4ce7273

Browse files
committed
cmds(repo rm-root): bring --remove-existing-root in-line with it's documentation
This command is already annoying enough. If a user decides to automate this, that's their issue (and we should allow it). (also rename back to remove-existing-root from remove-local-root) License: MIT Signed-off-by: Steven Allen <[email protected]>
1 parent 03e79f4 commit 4ce7273

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

core/commands/repo.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,11 @@ This command can only run when the ipfs daemon is not running.
286286
},
287287
Options: []cmdkit.Option{
288288
cmdkit.BoolOption("confirm", "Really perform operation."),
289-
cmdkit.BoolOption("remove-local-root", "Remove even if the root exists locally."),
289+
cmdkit.BoolOption("remove-existing-root", "Remove even if it root exists locally."),
290290
},
291291
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
292292
confirm, _ := req.Options["confirm"].(bool)
293-
removeLocalRoot, _ := req.Options["remove-local-root"].(bool)
293+
removeExistingRoot, _ := req.Options["remove-existing-root"].(bool)
294294

295295
if !confirm {
296296
return fmt.Errorf("this is a potentially dangerous operation please pass --confirm to proceed")
@@ -328,10 +328,8 @@ This command can only run when the ipfs daemon is not running.
328328
cidStr = b58.Encode(val)
329329
}
330330

331-
if have && !removeLocalRoot {
332-
return fmt.Errorf("root %s exists locally. Are you sure you want to unlink this? Pass --remove-local-root to continue", cidStr)
333-
} else if !have && removeLocalRoot {
334-
return fmt.Errorf("root does not %s exists locally. Please remove --remove-local-root to continue", cidStr)
331+
if have && !removeExistingRoot {
332+
return fmt.Errorf("root %s exists locally. Are you sure you want to unlink this? Pass --remove-existing-root to continue", cidStr)
335333
}
336334

337335
err = repo.Datastore().Delete(core.FilesRootKey)

0 commit comments

Comments
 (0)