mirror of https://github.com/spf13/cobra.git
Pass all tests by using correct flagComp lookups in completion command
code.
This commit is contained in:
parent
340cb4c7a3
commit
69578f24ad
|
@ -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 New Issue