From 69578f24adfe3bd0a8e1c822724ccb44f20f1c8b Mon Sep 17 00:00:00 2001 From: maxlandon Date: Thu, 2 Nov 2023 14:54:55 +0100 Subject: [PATCH] Pass all tests by using correct flagComp lookups in completion command code. --- completions.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/completions.go b/completions.go index 5e3521a0..73b6e1f9 100644 --- a/completions.go +++ b/completions.go @@ -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 }