Resolve conflict in completion flag check better
This commit is contained in:
parent
65b801c818
commit
744fdb45b5
20
help.go
20
help.go
@ -318,23 +318,31 @@ func checkShellCompleteFlag(a *App, arguments []string) (bool, []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkCompletions(c *Context) bool {
|
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)
|
ShowCompletions(c)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkCommandCompletions(c *Context, name string) bool {
|
||||||
|
if !c.shellComplete {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkCommandCompletions(c *Context, name string) bool {
|
|
||||||
if c.shellComplete {
|
|
||||||
ShowCommandCompletions(c, name)
|
ShowCommandCompletions(c, name)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkInitCompletion(c *Context) (bool, error) {
|
func checkInitCompletion(c *Context) (bool, error) {
|
||||||
if c.IsSet(InitCompletionFlag.Name) {
|
if c.IsSet(InitCompletionFlag.Name) {
|
||||||
shell := c.String(InitCompletionFlag.Name)
|
shell := c.String(InitCompletionFlag.Name)
|
||||||
|
Loading…
Reference in New Issue
Block a user