MCPcopy
hub / github.com/spf13/cobra / GetFlagCompletionFunc

Method GetFlagCompletionFunc

completions.go:186–197  ·  view source on GitHub ↗

GetFlagCompletionFunc returns the completion function for the given flag of the command, if available.

(flagName string)

Source from the content-addressed store, hash-verified

184
185// GetFlagCompletionFunc returns the completion function for the given flag of the command, if available.
186func (c *Command) GetFlagCompletionFunc(flagName string) (CompletionFunc, bool) {
187 flag := c.Flag(flagName)
188 if flag == nil {
189 return nil, false
190 }
191
192 flagCompletionMutex.RLock()
193 defer flagCompletionMutex.RUnlock()
194
195 completionFunc, exists := flagCompletionFunctions[flag]
196 return completionFunc, exists
197}
198
199// Returns a string listing the different directive enabled in the specified parameter
200func (d ShellCompDirective) string() string {

Callers 1

TestGetFlagCompletionFunction · 0.80

Calls 1

FlagMethod · 0.95

Tested by 1

TestGetFlagCompletionFunction · 0.64