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

View file

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