diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-09 04:40:50 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-09 04:42:35 +0300 |
| commit | bb2c579df206e51d43833544d114f321423c997c (patch) | |
| tree | a26c6702e048f31429ebaa260ee40c3c2b111d3e /src/cli.rs | |
| parent | 5460a9601ea8dd3d05e64e97040c71c6be29172b (diff) | |
feat(cli): support labels when creating tabs and workspaces
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 27 |
1 files changed, 24 insertions, 3 deletions
@@ -144,6 +144,7 @@ fn workspace_list(args: &[String]) -> std::io::Result<i32> { fn workspace_create(args: &[String]) -> std::io::Result<i32> { let mut cwd = None; let mut focus = true; + let mut label = None; let mut index = 0; while index < args.len() { @@ -156,6 +157,14 @@ fn workspace_create(args: &[String]) -> std::io::Result<i32> { cwd = Some(value.clone()); index += 2; } + "--label" => { + let Some(value) = args.get(index + 1) else { + eprintln!("missing value for --label"); + return Ok(2); + }; + label = Some(value.clone()); + index += 2; + } "--no-focus" => { focus = false; index += 1; @@ -169,7 +178,7 @@ fn workspace_create(args: &[String]) -> std::io::Result<i32> { print_response(&send_request(&Request { id: "cli:workspace:create".into(), - method: Method::WorkspaceCreate(WorkspaceCreateParams { cwd, focus }), + method: Method::WorkspaceCreate(WorkspaceCreateParams { cwd, focus, label }), })?) } @@ -273,6 +282,7 @@ fn tab_create(args: &[String]) -> std::io::Result<i32> { let mut workspace_id = None; let mut cwd = None; let mut focus = true; + let mut label = None; let mut index = 0; while index < args.len() { @@ -293,6 +303,14 @@ fn tab_create(args: &[String]) -> std::io::Result<i32> { cwd = Some(value.clone()); index += 2; } + "--label" => { + let Some(value) = args.get(index + 1) else { + eprintln!("missing value for --label"); + return Ok(2); + }; + label = Some(value.clone()); + index += 2; + } "--no-focus" => { focus = false; index += 1; @@ -310,6 +328,7 @@ fn tab_create(args: &[String]) -> std::io::Result<i32> { workspace_id, cwd, focus, + label, }), })?) } @@ -1055,7 +1074,7 @@ fn parse_u64_flag(flag: &str, value: &str) -> std::io::Result<u64> { fn print_workspace_help() { eprintln!("herdr workspace commands:"); eprintln!(" herdr workspace list"); - eprintln!(" herdr workspace create [--cwd PATH] [--no-focus]"); + eprintln!(" herdr workspace create [--cwd PATH] [--label TEXT] [--no-focus]"); eprintln!(" herdr workspace get <workspace_id>"); eprintln!(" herdr workspace focus <workspace_id>"); eprintln!(" herdr workspace rename <workspace_id> <label>"); @@ -1065,7 +1084,9 @@ fn print_workspace_help() { fn print_tab_help() { eprintln!("herdr tab commands:"); eprintln!(" herdr tab list [--workspace <workspace_id>]"); - eprintln!(" herdr tab create [--workspace <workspace_id>] [--cwd PATH] [--no-focus]"); + eprintln!( + " herdr tab create [--workspace <workspace_id>] [--cwd PATH] [--label TEXT] [--no-focus]" + ); eprintln!(" herdr tab get <tab_id>"); eprintln!(" herdr tab focus <tab_id>"); eprintln!(" herdr tab rename <tab_id> <label>"); |
