(terminal: string | null)
| 1212 | } |
| 1213 | |
| 1214 | export function toIDEDisplayName(terminal: string | null): string { |
| 1215 | if (!terminal) return 'IDE' |
| 1216 | |
| 1217 | const config = supportedIdeConfigs[terminal as IdeType] |
| 1218 | if (config) { |
| 1219 | return config.displayName |
| 1220 | } |
| 1221 | |
| 1222 | // Check editor command names (exact match first) |
| 1223 | const editorName = EDITOR_DISPLAY_NAMES[terminal.toLowerCase().trim()] |
| 1224 | if (editorName) { |
| 1225 | return editorName |
| 1226 | } |
| 1227 | |
| 1228 | // Extract command name from path/arguments (e.g., "/usr/bin/code --wait" -> "code") |
| 1229 | const command = terminal.split(' ')[0] |
| 1230 | const commandName = command ? basename(command).toLowerCase() : null |
| 1231 | if (commandName) { |
| 1232 | const mappedName = EDITOR_DISPLAY_NAMES[commandName] |
| 1233 | if (mappedName) { |
| 1234 | return mappedName |
| 1235 | } |
| 1236 | // Fallback: capitalize the command basename |
| 1237 | return capitalize(commandName) |
| 1238 | } |
| 1239 | |
| 1240 | // Fallback: capitalize first letter |
| 1241 | return capitalize(terminal) |
| 1242 | } |
| 1243 | |
| 1244 | export { callIdeRpc } |
| 1245 |
no test coverage detected