Commit f13e1fed authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

commands/http: Cleaned up argument handling in Parse

parent 065a3021
...@@ -45,9 +45,17 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) { ...@@ -45,9 +45,17 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
for _, arg := range cmd.Arguments { for _, arg := range cmd.Arguments {
if arg.Type == cmds.ArgString { if arg.Type == cmds.ArgString {
for j := 0; len(stringArgs) > 0 && arg.Variadic || j == 0; j++ { if arg.Variadic {
for _, s := range stringArgs {
args = append(args, s)
}
} else if len(stringArgs) > 0 {
args = append(args, stringArgs[0]) args = append(args, stringArgs[0])
stringArgs = stringArgs[1:] stringArgs = stringArgs[1:]
} else {
break
} }
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment