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
use serde::{Deserialize, Serialize};
use crate::{SessionName, TerminalSize};
/// Request payload for `new-session`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NewSessionRequest {
/// The exact session name to create.
pub session_name: SessionName,
/// Whether the session should remain detached after creation.
pub detached: bool,
/// The initial pane geometry, when explicitly requested.
pub size: Option<TerminalSize>,
/// Optional per-spawn environment overrides in `NAME=VALUE` form.
#[serde(default)]
pub environment: Option<Vec<String>>,
}
/// Extended request payload for `new-session`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NewSessionExtRequest {
/// The optional exact session name to create.
pub session_name: Option<SessionName>,
/// Optional tmux format-expanded start directory for the new session.
#[serde(default)]
pub working_directory: Option<String>,
/// Whether the session should remain detached after creation.
pub detached: bool,
/// The initial pane geometry, when explicitly requested.
pub size: Option<TerminalSize>,
/// Optional per-spawn environment overrides in `NAME=VALUE` form.
#[serde(default)]
pub environment: Option<Vec<String>>,
/// The optional target session or group name for grouped-session creation.
#[serde(default)]
pub group_target: Option<SessionName>,
/// Whether an existing target session should be attached instead of erroring.
#[serde(default)]
pub attach_if_exists: bool,
/// Whether other attached clients should be detached before attaching.
#[serde(default)]
pub detach_other_clients: bool,
/// Whether other attached clients should be detached and terminated.
#[serde(default)]
pub kill_other_clients: bool,
/// Optional tmux client-flag names such as `read-only` or `active-pane`.
#[serde(default)]
pub flags: Option<Vec<String>>,
/// The optional initial active-window name for standalone session creation.
#[serde(default)]
pub window_name: Option<String>,
/// Whether the created session should print formatted session information.
#[serde(default)]
pub print_session_info: bool,
/// The optional format template used when printing session information.
#[serde(default)]
pub print_format: Option<String>,
/// Optional shell command argv. A single argument is executed via `$SHELL -c`.
#[serde(default)]
pub command: Option<Vec<String>>,
}
/// Request payload for `has-session`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct HasSessionRequest {
/// The exact target session name.
pub target: SessionName,
}
/// Request payload for `kill-session`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct KillSessionRequest {
/// The exact target session name.
pub target: SessionName,
/// Whether every other session should be destroyed instead of the target session.
#[serde(default)]
pub kill_all_except_target: bool,
/// Whether the target session's window alert flags should be cleared instead of destroying it.
#[serde(default)]
pub clear_alerts: bool,
}
/// Request payload for `rename-session`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RenameSessionRequest {
/// The exact existing session name.
pub target: SessionName,
/// The validated destination session name.
pub new_name: SessionName,
}
/// Request payload for `list-sessions`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ListSessionsRequest {
/// An optional server-side format template.
pub format: Option<String>,
/// An optional server-side filter expression.
#[serde(default)]
pub filter: Option<String>,
/// The optional tmux sort order name.
#[serde(default)]
pub sort_order: Option<String>,
/// Whether the selected sort order should be reversed.
#[serde(default)]
pub reversed: bool,
}