worktree_io/opener/
editor.rs1pub fn resolve_editor_command(name: &str) -> String {
3 let candidates: &[(&str, &str)] = &[
4 ("vscode", "code ."),
5 ("cursor", "cursor ."),
6 ("code", "code ."),
7 ("zed", "zed ."),
8 ("subl", "subl ."),
9 ("nvim", "nvim ."),
10 ("vim", "vim ."),
11 ("iterm", "open -a iTerm ."),
12 ("iterm2", "open -a iTerm ."),
13 ("warp", "open -a Warp ."),
14 ("ghostty", "open -a Ghostty ."),
15 ("alacritty", "alacritty --working-directory ."),
16 ("kitty", "kitty --directory ."),
17 ("wezterm", "wezterm start --cwd ."),
18 ("wt", "wt -d ."),
19 ("windowsterminal", "wt -d ."),
20 ];
21 for &(sym, cmd) in candidates {
22 if name.eq_ignore_ascii_case(sym) {
23 return cmd.to_string();
24 }
25 }
26 if name.eq_ignore_ascii_case("terminal") {
27 #[cfg(target_os = "macos")]
28 return "open -a Terminal .".to_string();
29 #[cfg(target_os = "windows")]
30 return "wt -d .".to_string();
31 #[cfg(not(any(target_os = "macos", target_os = "windows")))]
32 return "xterm".to_string();
33 }
34 name.to_string()
35}