diff options
Diffstat (limited to 'src/cli/tab.rs')
| -rw-r--r-- | src/cli/tab.rs | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/src/cli/tab.rs b/src/cli/tab.rs index 955a1ba1..440b9797 100644 --- a/src/cli/tab.rs +++ b/src/cli/tab.rs @@ -1,8 +1,6 @@ use std::collections::HashMap; -use crate::api::schema::{ - Method, Request, TabCreateParams, TabListParams, TabRenameParams, TabTarget, -}; +use crate::api::schema::{TabCreateParams, TabListParams, TabRenameParams}; pub(super) fn run_tab_command(args: &[String]) -> std::io::Result<i32> { let Some(subcommand) = args.first().map(|arg| arg.as_str()) else { @@ -49,10 +47,7 @@ fn tab_list(args: &[String]) -> std::io::Result<i32> { } } - super::print_response(&super::send_request(&Request { - id: "cli:tab:list".into(), - method: Method::TabList(TabListParams { workspace_id }), - })?) + super::runtime::tab_list(TabListParams { workspace_id }) } fn tab_create(args: &[String]) -> std::io::Result<i32> { @@ -119,16 +114,13 @@ fn tab_create(args: &[String]) -> std::io::Result<i32> { } } - super::print_response(&super::send_request(&Request { - id: "cli:tab:create".into(), - method: Method::TabCreate(TabCreateParams { - workspace_id, - cwd, - focus, - label, - env, - }), - })?) + super::runtime::tab_create(TabCreateParams { + workspace_id, + cwd, + focus, + label, + env, + }) } fn tab_get(args: &[String]) -> std::io::Result<i32> { @@ -141,12 +133,7 @@ fn tab_get(args: &[String]) -> std::io::Result<i32> { return Ok(2); } - super::print_response(&super::send_request(&Request { - id: "cli:tab:get".into(), - method: Method::TabGet(TabTarget { - tab_id: super::normalize_tab_id(raw_tab_id), - }), - })?) + super::runtime::tab_get(super::normalize_tab_id(raw_tab_id)) } fn tab_focus(args: &[String]) -> std::io::Result<i32> { @@ -159,12 +146,7 @@ fn tab_focus(args: &[String]) -> std::io::Result<i32> { return Ok(2); } - super::print_response(&super::send_request(&Request { - id: "cli:tab:focus".into(), - method: Method::TabFocus(TabTarget { - tab_id: super::normalize_tab_id(raw_tab_id), - }), - })?) + super::runtime::tab_focus(super::normalize_tab_id(raw_tab_id)) } fn tab_rename(args: &[String]) -> std::io::Result<i32> { @@ -173,13 +155,10 @@ fn tab_rename(args: &[String]) -> std::io::Result<i32> { return Ok(2); } - super::print_response(&super::send_request(&Request { - id: "cli:tab:rename".into(), - method: Method::TabRename(TabRenameParams { - tab_id: super::normalize_tab_id(&args[0]), - label: args[1..].join(" "), - }), - })?) + super::runtime::tab_rename(TabRenameParams { + tab_id: super::normalize_tab_id(&args[0]), + label: args[1..].join(" "), + }) } fn tab_close(args: &[String]) -> std::io::Result<i32> { @@ -192,12 +171,7 @@ fn tab_close(args: &[String]) -> std::io::Result<i32> { return Ok(2); } - super::print_response(&super::send_request(&Request { - id: "cli:tab:close".into(), - method: Method::TabClose(TabTarget { - tab_id: super::normalize_tab_id(raw_tab_id), - }), - })?) + super::runtime::tab_close(super::normalize_tab_id(raw_tab_id)) } fn print_tab_help() { |
