Commit a69ddbb9 authored by Matt Bell's avatar Matt Bell

commands/cli: Fixed parse bug when optional argument is defined first

parent cefb0140
......@@ -182,9 +182,11 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi
argDef := getArgDef(argDefIndex, argDefs)
// skip optional argument definitions if there aren't sufficient remaining inputs
if numInputs-i <= numRequired && !argDef.Required {
continue
} else if argDef.Required {
for numInputs-i <= numRequired && !argDef.Required {
argDefIndex++
argDef = getArgDef(argDefIndex, argDefs)
}
if argDef.Required {
numRequired--
}
......
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