From 942bd58b1735a6b5dc815c98b4337a19b32ffc3c Mon Sep 17 00:00:00 2001 From: Iaroslav Gridin Date: Tue, 14 Aug 2018 19:52:58 +0300 Subject: [PATCH] Simplify pin removal command * Add -d/--direct for direct pins instead of -r=false * Remove explain as it does not belong here License: MIT Signed-off-by: Iaroslav Gridin --- core/commands/pin.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/commands/pin.go b/core/commands/pin.go index 05044e50670..e31f08f8015 100644 --- a/core/commands/pin.go +++ b/core/commands/pin.go @@ -180,7 +180,7 @@ var rmPinCmd = &cmds.Command{ Tagline: "Remove pinned objects from local storage.", ShortDescription: ` Removes the pin from the given object allowing it to be garbage -collected if needed. (By default, recursively. Use -r=false for direct pins.) +collected if needed. By default, removes recursive pins. `, }, @@ -188,8 +188,7 @@ collected if needed. (By default, recursively. Use -r=false for direct pins.) cmdkit.StringArg("pin-path", true, true, "Pin paths").EnableStdin(), }, Options: []cmdkit.Option{ - cmdkit.BoolOption("recursive", "r", "Recursively unpin the object linked to by the specified object(s).").WithDefault(true), - cmdkit.BoolOption("explain", "e", "Check for other pinned objects which could cause specified object(s) to be indirectly pinned").WithDefault(false), + cmdkit.BoolOption("direct", "d", "Unpins a direct pin").WithDefault(false), }, Type: PinOutput{}, Run: func(req cmds.Request, res cmds.Response) { @@ -200,7 +199,8 @@ collected if needed. (By default, recursively. Use -r=false for direct pins.) } // set recursive flag - recursive, _, err := req.Option("recursive").Bool() + direct, _, err := req.Option("direct").Bool() + recursive := !direct if err != nil { res.SetError(err, cmdkit.ErrNormal) return