show only subcommand flags with bash completion
This commit is contained in:
parent
d2d2098085
commit
a8e44a8b5b
3
help.go
3
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user