use crate::api::schema::{ EmptyParams, Method, Request, TabCreateParams, TabListParams, TabRenameParams, TabTarget, WorkspaceCreateParams, WorkspaceRenameParams, WorkspaceTarget, WorktreeCreateParams, WorktreeListParams, WorktreeOpenParams, WorktreeRemoveParams, }; fn print_method_response(id: &'static str, method: Method) -> std::io::Result { super::print_response(&super::send_request(&Request { id: id.into(), method, })?) } pub(super) fn workspace_list() -> std::io::Result { print_method_response( "cli:workspace:list", Method::WorkspaceList(EmptyParams::default()), ) } pub(super) fn workspace_create(params: WorkspaceCreateParams) -> std::io::Result { print_method_response("cli:workspace:create", Method::WorkspaceCreate(params)) } pub(super) fn workspace_get(workspace_id: String) -> std::io::Result { print_method_response( "cli:workspace:get", Method::WorkspaceGet(WorkspaceTarget { workspace_id }), ) } pub(super) fn workspace_focus(workspace_id: String) -> std::io::Result { print_method_response( "cli:workspace:focus", Method::WorkspaceFocus(WorkspaceTarget { workspace_id }), ) } pub(super) fn workspace_rename(params: WorkspaceRenameParams) -> std::io::Result { print_method_response("cli:workspace:rename", Method::WorkspaceRename(params)) } pub(super) fn workspace_close(workspace_id: String) -> std::io::Result { print_method_response( "cli:workspace:close", Method::WorkspaceClose(WorkspaceTarget { workspace_id }), ) } pub(super) fn tab_list(params: TabListParams) -> std::io::Result { print_method_response("cli:tab:list", Method::TabList(params)) } pub(super) fn tab_create(params: TabCreateParams) -> std::io::Result { print_method_response("cli:tab:create", Method::TabCreate(params)) } pub(super) fn tab_get(tab_id: String) -> std::io::Result { print_method_response("cli:tab:get", Method::TabGet(TabTarget { tab_id })) } pub(super) fn tab_focus(tab_id: String) -> std::io::Result { print_method_response("cli:tab:focus", Method::TabFocus(TabTarget { tab_id })) } pub(super) fn tab_rename(params: TabRenameParams) -> std::io::Result { print_method_response("cli:tab:rename", Method::TabRename(params)) } pub(super) fn tab_close(tab_id: String) -> std::io::Result { print_method_response("cli:tab:close", Method::TabClose(TabTarget { tab_id })) } pub(super) fn worktree_list(params: WorktreeListParams) -> std::io::Result { print_method_response("cli:worktree:list", Method::WorktreeList(params)) } pub(super) fn worktree_create(params: WorktreeCreateParams) -> std::io::Result { print_method_response("cli:worktree:create", Method::WorktreeCreate(params)) } pub(super) fn worktree_open(params: WorktreeOpenParams) -> std::io::Result { print_method_response("cli:worktree:open", Method::WorktreeOpen(params)) } pub(super) fn worktree_remove(params: WorktreeRemoveParams) -> std::io::Result { print_method_response("cli:worktree:remove", Method::WorktreeRemove(params)) }