diff --git a/context.go b/context.go index e0efb3a..2661e68 100644 --- a/context.go +++ b/context.go @@ -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 diff --git a/help.go b/help.go index abee58d..21b6de7 100644 --- a/help.go +++ b/help.go @@ -71,7 +71,8 @@ func printCommand(w *helpWriter, app *Application, cmd *Command) { } printNodeDetail(w, cmd) if w.Summary && app.HelpFlag != nil { - w.Printf(`Run "%s %s --help" for more information.`, app.Name, cmd.FullPath()) + w.Print("") + w.Printf(`Run "%s --help" for more information.`, cmd.FullPath()) } } diff --git a/kong_test.go b/kong_test.go index f67892b..f937b21 100644 --- a/kong_test.go +++ b/kong_test.go @@ -554,3 +554,15 @@ func TestInterpolationIntoModel(t *testing.T) { require.Equal(t, map[string]bool{"a": true, "b": true, "c": true, "d": true}, flag.EnumMap()) require.Equal(t, "One of a,b", flag2.Help) } + +func TestErrorMissingArgs(t *testing.T) { + var cli struct { + One string `arg:""` + Two string `arg:""` + } + + p := mustNew(t, &cli) + _, err := p.Parse(nil) + require.Error(t, err) + require.Equal(t, "expected \" \"", err.Error()) +}