Fix incorrect error missing for missing required args.

This commit is contained in:
Alec Thomas
2018-08-14 21:05:21 +10:00
parent f0bd1294a7
commit ebe508cf46
3 changed files with 21 additions and 2 deletions
+7 -1
View File
@@ -518,11 +518,17 @@ func checkMissingFlags(flags []*Flag) error {
func checkMissingChildren(node *Node) error {
missing := []string{}
missingArgs := []string{}
for _, arg := range node.Positional {
if arg.Required && !arg.Set {
missing = append(missing, strconv.Quote(arg.Summary()))
missingArgs = append(missingArgs, arg.Summary())
}
}
if len(missingArgs) > 0 {
missing = append(missing, strconv.Quote(strings.Join(missingArgs, " ")))
}
for _, child := range node.Children {
if child.Hidden {
continue