提交 d4ac4428 作者: Matt Bell

commands/cli: Fixed Parse required argument check

上级 ce49541f
...@@ -249,11 +249,13 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi ...@@ -249,11 +249,13 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi
} }
// check to make sure we didn't miss any required arguments // check to make sure we didn't miss any required arguments
if len(argDefs) > argDefIndex {
for _, argDef := range argDefs[argDefIndex:] { for _, argDef := range argDefs[argDefIndex:] {
if argDef.Required { if argDef.Required {
return nil, nil, fmt.Errorf("Argument '%s' is required", argDef.Name) return nil, nil, fmt.Errorf("Argument '%s' is required", argDef.Name)
} }
} }
}
return stringArgs, fileArgs, nil return stringArgs, fileArgs, nil
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论