| 1162 | let exCycle: ExTabCycle | null = null |
| 1163 | |
| 1164 | function completeCommandArgs( |
| 1165 | input: string, |
| 1166 | command: string, |
| 1167 | options: string[] |
| 1168 | ): ExCompletionMatch[] | null { |
| 1169 | const match = input.match(/^([A-Za-z0-9_]+)(\s+)([^ ]*)$/) |
| 1170 | if (!match) return null |
| 1171 | const [, commandName, whitespace, argPrefix] = match |
| 1172 | if (commandName.toLowerCase() !== command) return null |
| 1173 | const filtered = argPrefix |
| 1174 | ? options.filter((option) => option.startsWith(argPrefix.toLowerCase())) |
| 1175 | : options |
| 1176 | return filtered.map((option) => ({ |
| 1177 | label: option, |
| 1178 | apply: `${commandName}${whitespace}${option}` |
| 1179 | })) |
| 1180 | } |
| 1181 | |
| 1182 | function computeExMatches(prefix: string): ExCompletionMatch[] { |
| 1183 | const argMatches = |