worktree_io/opener/editor.rs
1use super::entries::all_entries;
2
3/// Map a short editor name (e.g. "terminal", "vscode", "cursor") to a shell command.
4#[must_use]
5pub fn resolve_editor_command(name: &str) -> String {
6 for entry in all_entries() {
7 if entry.aliases.iter().any(|&a| a.eq_ignore_ascii_case(name)) {
8 return entry.command.to_string();
9 }
10 }
11 #[cfg(not(any(target_os = "macos", target_os = "windows")))]
12 if name.eq_ignore_ascii_case("terminal") {
13 return "xterm".to_string();
14 }
15 name.to_string()
16}