GetFlagCompletionFunc returns the completion function for the given flag of the command, if available.
(flagName string)
| 184 | |
| 185 | // GetFlagCompletionFunc returns the completion function for the given flag of the command, if available. |
| 186 | func (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 |
| 200 | func (d ShellCompDirective) string() string { |