Skip to content

Commit 942bd58

Browse files
committed
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 <[email protected]>
1 parent 23a7aa0 commit 942bd58

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/commands/pin.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,15 @@ var rmPinCmd = &cmds.Command{
180180
Tagline: "Remove pinned objects from local storage.",
181181
ShortDescription: `
182182
Removes the pin from the given object allowing it to be garbage
183-
collected if needed. (By default, recursively. Use -r=false for direct pins.)
183+
collected if needed. By default, removes recursive pins.
184184
`,
185185
},
186186

187187
Arguments: []cmdkit.Argument{
188188
cmdkit.StringArg("pin-path", true, true, "Pin paths").EnableStdin(),
189189
},
190190
Options: []cmdkit.Option{
191-
cmdkit.BoolOption("recursive", "r", "Recursively unpin the object linked to by the specified object(s).").WithDefault(true),
192-
cmdkit.BoolOption("explain", "e", "Check for other pinned objects which could cause specified object(s) to be indirectly pinned").WithDefault(false),
191+
cmdkit.BoolOption("direct", "d", "Unpins a direct pin").WithDefault(false),
193192
},
194193
Type: PinOutput{},
195194
Run: func(req cmds.Request, res cmds.Response) {
@@ -200,7 +199,8 @@ collected if needed. (By default, recursively. Use -r=false for direct pins.)
200199
}
201200

202201
// set recursive flag
203-
recursive, _, err := req.Option("recursive").Bool()
202+
direct, _, err := req.Option("direct").Bool()
203+
recursive := !direct
204204
if err != nil {
205205
res.SetError(err, cmdkit.ErrNormal)
206206
return

0 commit comments

Comments
 (0)