matchVariableOrCommand attempts to match a string token to the prefix of a Command.
(token string)
| 379 | |
| 380 | // matchVariableOrCommand attempts to match a string token to the prefix of a Command. |
| 381 | func matchVariableOrCommand(token string) string { |
| 382 | token = strings.ToLower(token) |
| 383 | var matches []string |
| 384 | for cmd := range pprofCommands { |
| 385 | if strings.HasPrefix(cmd, token) { |
| 386 | matches = append(matches, cmd) |
| 387 | } |
| 388 | } |
| 389 | matches = append(matches, completeConfig(token)...) |
| 390 | if len(matches) == 1 { |
| 391 | return matches[0] |
| 392 | } |
| 393 | return "" |
| 394 | } |
| 395 | |
| 396 | // functionCompleter replaces provided substring with a function |
| 397 | // name retrieved from a profile if a single match exists. Otherwise, |
no test coverage detected
searching dependent graphs…