Skip to content

Commit

Permalink
commands/http: Cleaned up argument handling in Parse
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Nov 4, 2014
1 parent 2d8cd94 commit 55670a5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion commands/http/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {

for _, arg := range cmd.Arguments {
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)
}

This comment has been minimized.

Copy link
@jbenet

jbenet Nov 4, 2014

Member
// does what the for loop does
args = append(args, stringArgs...)

} else if len(stringArgs) > 0 {
args = append(args, stringArgs[0])
stringArgs = stringArgs[1:]

} else {
break
}

} else {
Expand Down

0 comments on commit 55670a5

Please sign in to comment.