contextFlagValueSuggestions returns value suggestions for flags whose position is immediately after `--mode`/`-m` (mode list), or signals that the previous flag expects free text (description/tags) and the completer should bail out silently.
(args []string, line string)
| 728 | // the previous flag expects free text (description/tags) and the completer |
| 729 | // should bail out silently. |
| 730 | func contextFlagValueSuggestions(args []string, line string) ([]prompt.Suggest, bool) { |
| 731 | if len(args) < 2 { |
| 732 | return nil, false |
| 733 | } |
| 734 | prev := previousToken(args, line) |
| 735 | switch prev { |
| 736 | case "--mode", "-m": |
| 737 | return contextModeValueSuggestions(), true |
| 738 | case "--description", "--desc", "-d", "--tags", "-t": |
| 739 | return []prompt.Suggest{}, true |
| 740 | } |
| 741 | return nil, false |
| 742 | } |
| 743 | |
| 744 | // contextMergeSuggestions: prompt for the new name first, then existing |
| 745 | // context names to merge. |