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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
use crate::api::schema::{
EmptyParams, Method, PaneFocusDirectionParams, PaneInputSetParams, PaneMoveParams,
PaneRenameParams, PaneResizeParams, PaneSplitParams, PaneSwapParams, PaneTarget,
PaneZoomParams, Request, TabCreateParams, TabListParams, TabRenameParams, TabTarget,
WorkspaceCloseParams, 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(params: WorkspaceCloseParams) -> std::io::Result<i32> {
print_method_response("cli:workspace:close", Method::WorkspaceClose(params))
}
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))
}
pub(super) fn pane_focus(params: PaneFocusDirectionParams) -> std::io::Result<i32> {
print_method_response("cli:pane:focus", Method::PaneFocusDirection(params))
}
pub(super) fn pane_resize(params: PaneResizeParams) -> std::io::Result<i32> {
print_method_response("cli:pane:resize", Method::PaneResize(params))
}
pub(super) fn pane_zoom(params: PaneZoomParams) -> std::io::Result<i32> {
print_method_response("cli:pane:zoom", Method::PaneZoom(params))
}
pub(super) fn pane_rename(params: PaneRenameParams) -> std::io::Result<i32> {
print_method_response("cli:pane:rename", Method::PaneRename(params))
}
pub(super) fn pane_input_set(params: PaneInputSetParams) -> std::io::Result<i32> {
print_method_response("cli:pane:input:set", Method::PaneInputSet(params))
}
pub(super) fn pane_split(params: PaneSplitParams) -> std::io::Result<i32> {
print_method_response("cli:pane:split", Method::PaneSplit(params))
}
pub(super) fn pane_swap(params: PaneSwapParams) -> std::io::Result<i32> {
print_method_response("cli:pane:swap", Method::PaneSwap(params))
}
pub(super) fn pane_move(params: PaneMoveParams) -> std::io::Result<i32> {
print_method_response("cli:pane:move", Method::PaneMove(params))
}
pub(super) fn pane_close(pane_id: String) -> std::io::Result<i32> {
print_method_response("cli:pane:close", Method::PaneClose(PaneTarget { pane_id }))
}
|