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
|
||||
var completionFn func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)
|
||||
if flag != nil && flagCompletion {
|
||||
c.initializeCompletionStorage()
|
||||
|
||||
finalCmd.flagCompletionMutex.RLock()
|
||||
completionFn = finalCmd.flagCompletionFunctions[flag]
|
||||
finalCmd.flagCompletionMutex.RUnlock()
|
||||
completionFn, _ = finalCmd.GetFlagCompletion(flag)
|
||||
} else {
|
||||
completionFn = finalCmd.ValidArgsFunction
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue