1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 11:31:54 +08:00

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

This commit is contained in:
Matt Bell
2014-11-19 03:23:21 -08:00
parent 928f20b4bd
commit 5461d76957

View File

@ -138,8 +138,10 @@ Use --type=<type> to specify the type of pinned keys to list. Valid values are:
typeStr = "direct"
}
if typeStr != "all" && typeStr != "direct" && typeStr != "indirect" && typeStr != "recursive" {
return nil, cmds.ClientError("Invalid type '" + typeStr + "', must be \"direct\", \"indirect\", \"recursive\", or \"all\"")
switch typeStr {
case "all", "direct", "indirect", "recursive":
default:
return nil, cmds.ClientError("Invalid type '" + typeStr + "', must be one of {direct, indirect, recursive, all}")
}
keys := make([]u.Key, 0)