(word string, command *CommandDefinition, exclude []string)
| 182 | } |
| 183 | |
| 184 | func (a autoCompleteHandler) searchFlags(word string, command *CommandDefinition, exclude []string) []string { |
| 185 | result := []string{} |
| 186 | for _, flag := range command.Flags { |
| 187 | if strings.HasPrefix(flag.Name, word) { |
| 188 | result = append(result, "--"+flag.Name) |
| 189 | } |
| 190 | } |
| 191 | for _, flag := range command.Flags { |
| 192 | if strings.Contains(flag.Name, word) { |
| 193 | result = append(result, "--"+flag.Name) |
| 194 | } |
| 195 | } |
| 196 | return a.removeDuplicates(a.removeExcluded(result, exclude)) |
| 197 | } |
| 198 | |
| 199 | func (a autoCompleteHandler) removeDuplicates(values []string) []string { |
| 200 | keys := make(map[string]bool) |
no test coverage detected