From ce6c0dc842c3614789624e5cdc6689b580e62806 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sat, 4 Jul 2026 16:19:15 +0300 Subject: refactor: route cli workspace tab worktree through runtime adapters --- src/cli/worktree.rs | 59 +++++++++++++++++++++-------------------------------- 1 file changed, 23 insertions(+), 36 deletions(-) (limited to 'src/cli/worktree.rs') diff --git a/src/cli/worktree.rs b/src/cli/worktree.rs index 53ad685b..b96bcb8f 100644 --- a/src/cli/worktree.rs +++ b/src/cli/worktree.rs @@ -1,6 +1,5 @@ use crate::api::schema::{ - Method, Request, WorktreeCreateParams, WorktreeListParams, WorktreeOpenParams, - WorktreeRemoveParams, + WorktreeCreateParams, WorktreeListParams, WorktreeOpenParams, WorktreeRemoveParams, }; pub(super) fn run_worktree_command(args: &[String]) -> std::io::Result { @@ -60,10 +59,7 @@ fn worktree_list(args: &[String]) -> std::io::Result { return Ok(2); } - super::print_response(&super::send_request(&Request { - id: "cli:worktree:list".into(), - method: Method::WorktreeList(WorktreeListParams { workspace_id, cwd }), - })?) + super::runtime::worktree_list(WorktreeListParams { workspace_id, cwd }) } fn worktree_create(args: &[String]) -> std::io::Result { @@ -148,18 +144,15 @@ fn worktree_create(args: &[String]) -> std::io::Result { return Ok(2); } - super::print_response(&super::send_request(&Request { - id: "cli:worktree:create".into(), - method: Method::WorktreeCreate(WorktreeCreateParams { - workspace_id, - cwd, - branch, - base, - path, - label, - focus, - }), - })?) + super::runtime::worktree_create(WorktreeCreateParams { + workspace_id, + cwd, + branch, + base, + path, + label, + focus, + }) } fn worktree_open(args: &[String]) -> std::io::Result { @@ -241,17 +234,14 @@ fn worktree_open(args: &[String]) -> std::io::Result { return Ok(2); } - super::print_response(&super::send_request(&Request { - id: "cli:worktree:open".into(), - method: Method::WorktreeOpen(WorktreeOpenParams { - workspace_id, - cwd, - path, - branch, - label, - focus, - }), - })?) + super::runtime::worktree_open(WorktreeOpenParams { + workspace_id, + cwd, + path, + branch, + label, + focus, + }) } fn worktree_remove(args: &[String]) -> std::io::Result { @@ -286,13 +276,10 @@ fn worktree_remove(args: &[String]) -> std::io::Result { return Ok(2); }; - super::print_response(&super::send_request(&Request { - id: "cli:worktree:remove".into(), - method: Method::WorktreeRemove(WorktreeRemoveParams { - workspace_id, - force, - }), - })?) + super::runtime::worktree_remove(WorktreeRemoveParams { + workspace_id, + force, + }) } fn print_worktree_help() { -- cgit v1.2.3