Pass all tests by using correct flagComp lookups in completion command

code.
This commit is contained in:
maxlandon 2023-11-02 14:54:55 +01:00
parent 340cb4c7a3
commit 69578f24ad
No known key found for this signature in database
GPG Key ID: 2DE5C14975A86900
1 changed files with 1 additions and 5 deletions

View File

@ -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
} }