diff --git a/commands/cli/parse.go b/commands/cli/parse.go index a26b4b78f..8972fa96d 100644 --- a/commands/cli/parse.go +++ b/commands/cli/parse.go @@ -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) { diff --git a/commands/http/parse.go b/commands/http/parse.go index b23240739..979bacb78 100644 --- a/commands/http/parse.go +++ b/commands/http/parse.go @@ -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 {