@@ -36,6 +36,12 @@ enum Commands { |
| 36 | 36 | /// Working directory |
| 37 | 37 | #[arg(long)] |
| 38 | 38 | cwd: Option<String>, |
| 39 | + /// Command to run after shell starts |
| 40 | + #[arg(long, short = 'e')] |
| 41 | + exec: Option<String>, |
| 42 | + /// Tab title |
| 43 | + #[arg(long, short = 't')] |
| 44 | + title: Option<String>, |
| 39 | 45 | }, |
| 40 | 46 | /// Close the current tab |
| 41 | 47 | CloseTab, |
@@ -53,6 +59,17 @@ enum Commands { |
| 53 | 59 | /// Split horizontally (side-by-side) |
| 54 | 60 | #[arg(long, short = 'H')] |
| 55 | 61 | horizontal: bool, |
| 62 | + /// Working directory |
| 63 | + #[arg(long)] |
| 64 | + cwd: Option<String>, |
| 65 | + /// Command to run after shell starts |
| 66 | + #[arg(long, short = 'e')] |
| 67 | + exec: Option<String>, |
| 68 | + }, |
| 69 | + /// Load a named session from config |
| 70 | + LoadSession { |
| 71 | + /// Session name |
| 72 | + name: String, |
| 56 | 73 | }, |
| 57 | 74 | /// Close the focused pane |
| 58 | 75 | ClosePane, |
@@ -204,17 +221,24 @@ fn main() -> Result<()> { |
| 204 | 221 | // Convert command enum to IPC Command |
| 205 | 222 | let cmd = match &cli.command { |
| 206 | 223 | Commands::List => unreachable!(), |
| 207 | | - Commands::NewTab { cwd } => Command::NewTab { cwd: cwd.clone() }, |
| 224 | + Commands::NewTab { cwd, exec, title } => Command::NewTab { |
| 225 | + cwd: cwd.clone(), |
| 226 | + startup_cmd: exec.clone(), |
| 227 | + title: title.clone(), |
| 228 | + }, |
| 208 | 229 | Commands::CloseTab => Command::CloseTab, |
| 209 | 230 | Commands::NextTab => Command::NextTab, |
| 210 | 231 | Commands::PrevTab => Command::PrevTab, |
| 211 | 232 | Commands::Tab { index } => Command::SwitchTab { index: *index }, |
| 212 | | - Commands::Split { horizontal } => Command::Split { |
| 233 | + Commands::Split { horizontal, cwd, exec } => Command::Split { |
| 213 | 234 | direction: if *horizontal { "horizontal".into() } else { "vertical".into() }, |
| 235 | + cwd: cwd.clone(), |
| 236 | + startup_cmd: exec.clone(), |
| 214 | 237 | }, |
| 215 | 238 | Commands::ClosePane => Command::ClosePane, |
| 216 | 239 | Commands::Focus { direction } => Command::FocusPaneDirection { direction: direction.clone() }, |
| 217 | 240 | Commands::Send { text } => Command::SendText { text: text.clone() }, |
| 241 | + Commands::LoadSession { name } => Command::LoadSession { name: name.clone() }, |
| 218 | 242 | Commands::Info => Command::GetInfo, |
| 219 | 243 | Commands::Reload => Command::Reload, |
| 220 | 244 | Commands::Quit => Command::Quit, |