提交 83cda2e6 作者: Matt Bell 提交者: Juan Batiz-Benet

commands/http: Fixed arg parse bug

上级 fecb434a
......@@ -61,17 +61,18 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
if valCount <= lenRequired && !argDef.Required {
continue
}
valCount--
if argDef.Type == cmds.ArgString {
if argDef.Variadic {
for _, s := range stringArgs {
args = append(args, s)
}
valCount -= len(stringArgs)
} else if len(stringArgs) > 0 {
args = append(args, stringArgs[0])
stringArgs = stringArgs[1:]
valCount--
} else {
break
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论