From a8e44a8b5b1a75b1bfd95a46f809f9aba3ddb214 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Thu, 17 Sep 2020 12:46:05 -0700 Subject: [PATCH] show only subcommand flags with bash completion --- help.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/help.go b/help.go index c1e974a481..95ba188945 100644 --- a/help.go +++ b/help.go @@ -164,9 +164,10 @@ func DefaultCompleteWithFlags(cmd *Command) func(c *Context) { if len(os.Args) > 2 { lastArg := os.Args[len(os.Args)-2] if strings.HasPrefix(lastArg, "-") { - printFlagSuggestions(lastArg, c.App.Flags, c.App.Writer) if cmd != nil { printFlagSuggestions(lastArg, cmd.Flags, c.App.Writer) + } else { + printFlagSuggestions(lastArg, c.App.Flags, c.App.Writer) } return }