toIDEDisplayName function

String toIDEDisplayName(
  1. String? terminal
)

Convert a terminal name to a display-friendly IDE name.

Implementation

String toIDEDisplayName(String? terminal) {
  if (terminal == null) return 'IDE';

  // Check supported IDE configs
  for (final entry in supportedIdeConfigs.entries) {
    if (entry.key.name == terminal) {
      return entry.value.displayName;
    }
  }

  // Check editor command names (exact match first)
  final editorName = _editorDisplayNames[terminal.toLowerCase().trim()];
  if (editorName != null) return editorName;

  // Extract command name from path/arguments
  final command = terminal.split(' ').first;
  final commandName = command.split('/').last.toLowerCase();
  final mappedName = _editorDisplayNames[commandName];
  if (mappedName != null) return mappedName;

  // Fallback: capitalize the command basename
  if (commandName.isNotEmpty) {
    return commandName[0].toUpperCase() + commandName.substring(1);
  }
  return terminal;
}