1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
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<i32> {
super::print_response(&super::send_request(&Request {
id: id.into(),
method,
})?)
}
pub(super) fn workspace_list() -> std::io::Result<i32> {
print_method_response(
"cli:workspace:list",
Method::WorkspaceList(EmptyParams::default()),
)
}
pub(super) fn workspace_create(params: WorkspaceCreateParams) -> std::io::Result<i32> {
print_method_response("cli:workspace:create", Method::WorkspaceCreate(params))
}
pub(super) fn workspace_get(workspace_id: String) -> std::io::Result<i32> {
print_method_response(
"cli:workspace:get",
Method::WorkspaceGet(WorkspaceTarget { workspace_id }),
)
}
pub(super) fn workspace_focus(workspace_id: String) -> std::io::Result<i32> {
print_method_response(
"cli:workspace:focus",
Method::WorkspaceFocus(WorkspaceTarget { workspace_id }),
)
}
pub(super) fn workspace_rename(params: WorkspaceRenameParams) -> std::io::Result<i32> {
print_method_response("cli:workspace:rename", Method::WorkspaceRename(params))
}
pub(super) fn workspace_close(workspace_id: String) -> std::io::Result<i32> {
print_method_response(
"cli:workspace:close",
Method::WorkspaceClose(WorkspaceTarget { workspace_id }),
)
}
pub(super) fn tab_list(params: TabListParams) -> std::io::Result<i32> {
print_method_response("cli:tab:list", Method::TabList(params))
}
pub(super) fn tab_create(params: TabCreateParams) -> std::io::Result<i32> {
print_method_response("cli:tab:create", Method::TabCreate(params))
}
pub(super) fn tab_get(tab_id: String) -> std::io::Result<i32> {
print_method_response("cli:tab:get", Method::TabGet(TabTarget { tab_id }))
}
pub(super) fn tab_focus(tab_id: String) -> std::io::Result<i32> {
print_method_response("cli:tab:focus", Method::TabFocus(TabTarget { tab_id }))
}
pub(super) fn tab_rename(params: TabRenameParams) -> std::io::Result<i32> {
print_method_response("cli:tab:rename", Method::TabRename(params))
}
pub(super) fn tab_close(tab_id: String) -> std::io::Result<i32> {
print_method_response("cli:tab:close", Method::TabClose(TabTarget { tab_id }))
}
pub(super) fn worktree_list(params: WorktreeListParams) -> std::io::Result<i32> {
print_method_response("cli:worktree:list", Method::WorktreeList(params))
}
pub(super) fn worktree_create(params: WorktreeCreateParams) -> std::io::Result<i32> {
print_method_response("cli:worktree:create", Method::WorktreeCreate(params))
}
pub(super) fn worktree_open(params: WorktreeOpenParams) -> std::io::Result<i32> {
print_method_response("cli:worktree:open", Method::WorktreeOpen(params))
}
pub(super) fn worktree_remove(params: WorktreeRemoveParams) -> std::io::Result<i32> {
print_method_response("cli:worktree:remove", Method::WorktreeRemove(params))
}
|