diff --git a/completions.go b/completions.go index 5e3521a..73b6e1f 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 }