@cryptotaxi247 / kubo / commits / 5461d7695

core/commands: Better syntax for 'pin ls' option value handling

Matt Bell committed Nov 19, 2014 at 03:23 UTC 5461d769579c02b637e507135980d93d590b6401
1 file changed +4 -2
core/commands/pin.go
+4 -2
@@ -138,8 +138,10 @@ Use --type=<type> to specify the type of pinned keys to list. Valid values are:
138 typeStr = "direct"
139 }
140
141 - if typeStr != "all" && typeStr != "direct" && typeStr != "indirect" && typeStr != "recursive" {
142 - return nil, cmds.ClientError("Invalid type '" + typeStr + "', must be \"direct\", \"indirect\", \"recursive\", or \"all\"")
141 + switch typeStr {
142 + case "all", "direct", "indirect", "recursive":
143 + default:
144 + return nil, cmds.ClientError("Invalid type '" + typeStr + "', must be one of {direct, indirect, recursive, all}")
145 }
146
147 keys := make([]u.Key, 0)