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

commands: Fixed parser argument bug (TODO: better test coverage for command parsers)

parent 792b122f
......@@ -132,6 +132,8 @@ func parseArgs(stringArgs []string, cmd *cmds.Command) ([]interface{}, error) {
// skip optional argument definitions if there aren't sufficient remaining values
if len(stringArgs)-j <= lenRequired && !argDef.Required {
continue
} else if argDef.Required {
lenRequired--
}
if j >= len(stringArgs) {
......
......@@ -60,6 +60,8 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
// skip optional argument definitions if there aren't sufficient remaining values
if valCount <= lenRequired && !argDef.Required {
continue
} else if argDef.Required {
lenRequired--
}
if argDef.Type == cmds.ArgString {
......
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