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