mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
Pass all tests by using correct flagComp lookups in completion command
code.
This commit is contained in:
parent
340cb4c7a3
commit
69578f24ad
1 changed files with 1 additions and 5 deletions
|
@ -532,11 +532,7 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi
|
||||||
// Find the completion function for the flag or command
|
// Find the completion function for the flag or command
|
||||||
var completionFn func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)
|
var completionFn func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)
|
||||||
if flag != nil && flagCompletion {
|
if flag != nil && flagCompletion {
|
||||||
c.initializeCompletionStorage()
|
completionFn, _ = finalCmd.GetFlagCompletion(flag)
|
||||||
|
|
||||||
finalCmd.flagCompletionMutex.RLock()
|
|
||||||
completionFn = finalCmd.flagCompletionFunctions[flag]
|
|
||||||
finalCmd.flagCompletionMutex.RUnlock()
|
|
||||||
} else {
|
} else {
|
||||||
completionFn = finalCmd.ValidArgsFunction
|
completionFn = finalCmd.ValidArgsFunction
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue