@@ -36,6 +36,12 @@ enum Commands { |
| 36 | /// Working directory | 36 | /// Working directory |
| 37 | #[arg(long)] | 37 | #[arg(long)] |
| 38 | cwd: Option<String>, | 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 | /// Close the current tab | 46 | /// Close the current tab |
| 41 | CloseTab, | 47 | CloseTab, |
@@ -53,6 +59,17 @@ enum Commands { |
| 53 | /// Split horizontally (side-by-side) | 59 | /// Split horizontally (side-by-side) |
| 54 | #[arg(long, short = 'H')] | 60 | #[arg(long, short = 'H')] |
| 55 | horizontal: bool, | 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 | /// Close the focused pane | 74 | /// Close the focused pane |
| 58 | ClosePane, | 75 | ClosePane, |
@@ -204,17 +221,24 @@ fn main() -> Result<()> { |
| 204 | // Convert command enum to IPC Command | 221 | // Convert command enum to IPC Command |
| 205 | let cmd = match &cli.command { | 222 | let cmd = match &cli.command { |
| 206 | Commands::List => unreachable!(), | 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 | Commands::CloseTab => Command::CloseTab, | 229 | Commands::CloseTab => Command::CloseTab, |
| 209 | Commands::NextTab => Command::NextTab, | 230 | Commands::NextTab => Command::NextTab, |
| 210 | Commands::PrevTab => Command::PrevTab, | 231 | Commands::PrevTab => Command::PrevTab, |
| 211 | Commands::Tab { index } => Command::SwitchTab { index: *index }, | 232 | Commands::Tab { index } => Command::SwitchTab { index: *index }, |
| 212 | - Commands::Split { horizontal } => Command::Split { | 233 | + Commands::Split { horizontal, cwd, exec } => Command::Split { |
| 213 | direction: if *horizontal { "horizontal".into() } else { "vertical".into() }, | 234 | direction: if *horizontal { "horizontal".into() } else { "vertical".into() }, |
| | 235 | + cwd: cwd.clone(), |
| | 236 | + startup_cmd: exec.clone(), |
| 214 | }, | 237 | }, |
| 215 | Commands::ClosePane => Command::ClosePane, | 238 | Commands::ClosePane => Command::ClosePane, |
| 216 | Commands::Focus { direction } => Command::FocusPaneDirection { direction: direction.clone() }, | 239 | Commands::Focus { direction } => Command::FocusPaneDirection { direction: direction.clone() }, |
| 217 | Commands::Send { text } => Command::SendText { text: text.clone() }, | 240 | Commands::Send { text } => Command::SendText { text: text.clone() }, |
| | 241 | + Commands::LoadSession { name } => Command::LoadSession { name: name.clone() }, |
| 218 | Commands::Info => Command::GetInfo, | 242 | Commands::Info => Command::GetInfo, |
| 219 | Commands::Reload => Command::Reload, | 243 | Commands::Reload => Command::Reload, |
| 220 | Commands::Quit => Command::Quit, | 244 | Commands::Quit => Command::Quit, |