Resolve conflict in completion flag check better

This commit is contained in:
Dan Buch 2017-08-12 22:07:03 -04:00
parent 65b801c818
commit 744fdb45b5
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7

20
help.go
View File

@ -318,23 +318,31 @@ func checkShellCompleteFlag(a *App, arguments []string) (bool, []string) {
}
func checkCompletions(c *Context) bool {
if c.shellComplete {
if !c.shellComplete {
return false
}
if args := c.Args(); args.Present() {
name := args.First()
if cmd := c.App.Command(name); cmd != nil {
// let the command handle the completion
return false
}
}
ShowCompletions(c)
return true
}
func checkCommandCompletions(c *Context, name string) bool {
if !c.shellComplete {
return false
}
func checkCommandCompletions(c *Context, name string) bool {
if c.shellComplete {
ShowCommandCompletions(c, name)
return true
}
return false
}
func checkInitCompletion(c *Context) (bool, error) {
if c.IsSet(InitCompletionFlag.Name) {
shell := c.String(InitCompletionFlag.Name)