show only subcommand flags with bash completion

main
Zack Scholl 4 years ago
parent d2d2098085
commit a8e44a8b5b

@ -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
}

Loading…
Cancel
Save