提交 f15abc22 作者: Steven Allen

use the builtin option parser to set the default for `ipfs pin ls --type`

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 ef4e8837
......@@ -187,7 +187,7 @@ Example:
cmds.StringArg("ipfs-path", false, true, "Path to object(s) to be listed."),
},
Options: []cmds.Option{
cmds.StringOption("type", "t", "The type of pinned keys to list. Can be \"direct\", \"indirect\", \"recursive\", or \"all\". Defaults to \"recursive\"."),
cmds.StringOption("type", "t", "The type of pinned keys to list. Can be \"direct\", \"indirect\", \"recursive\", or \"all\".").Default("all"),
cmds.BoolOption("count", "n", "Show refcount when listing indirect pins."),
cmds.BoolOption("quiet", "q", "Write just hashes of objects."),
},
......@@ -198,13 +198,12 @@ Example:
return
}
typeStr, typeStrFound, err := req.Option("type").String()
typeStr, _, err := req.Option("type").String()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
if typeStrFound {
switch typeStr {
case "all", "direct", "indirect", "recursive":
default:
......@@ -212,9 +211,6 @@ Example:
res.SetError(err, cmds.ErrClient)
return
}
} else {
typeStr = "all"
}
var keys map[string]RefKeyObject
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论