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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
// auto-generated file
//
use crate::commands::constants::*;
#[cfg(feature = "tmux_2_9a")]
use crate::ClientFlags;
use crate::TmuxCommand;
#[cfg(feature = "tmux_3_2")]
use crate::{AllowActions, Subscribe};
use std::borrow::Cow;
pub type Refresh<'a> = RefreshClient<'a>;
/// Refresh current client
///
/// # Manual
///
/// tmux >=3.3:
/// ```text
/// refresh-client [-cDLRSU] [-A pane:state] [-B name:what:format] [-C XxY] [-f flags]
/// [-l [target-pane]] [-t target-client] [adjustment] (alias: refresh)
/// ```
///
/// tmux >=3.2:
/// ```text
/// refresh-client [-cDlLRSU] [-A pane:state] [-B name:what:format] [-C XxY] [-f flags] [-t target-client] [adjustment]
/// (alias: refresh)
/// ```
///
/// tmux >=3.0a:
/// ```text
/// refresh-client [-cDlLRSU] [-C XxY] [-F flags] [-t target-client] [adjustment]
/// (alias: refresh)
/// ```
///
/// tmux >=2.9:
/// ```text
/// refresh-client [-cDlLRSU] [-C width,height] [-F flags] [-t target-client] [adjustment]
/// (alias: refresh)
/// ```
///
/// tmux >=2.4:
/// ```text
/// refresh-client [-C width,height] [-S] [-t target-client]
/// (alias: refresh)
/// ```
///
/// tmux >=1.6:
/// ```text
/// refresh-client [-S] [-t target-client]
/// (alias: refresh)
/// ```
///
/// tmux >=0.8:
/// ```text
/// refresh-client [-t target-client]
/// (alias: refresh)
/// ```
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
pub struct RefreshClient<'a> {
/// `[-c]`
#[cfg(feature = "tmux_2_9")]
pub tracking_cursor: bool,
/// `[-D]`
#[cfg(feature = "tmux_2_9")]
pub down: bool,
/// `[-l]`
#[cfg(all(feature = "tmux_2_9", not(feature = "tmux_3_3")))]
pub request_clipboard: bool,
/// `[-L]`
#[cfg(feature = "tmux_2_9")]
pub left: bool,
/// `[-R]`
#[cfg(feature = "tmux_2_9")]
pub right: bool,
/// `[-S]`
#[cfg(all(feature = "tmux_1_6"))]
pub status_line: bool,
/// `[-U]`
#[cfg(feature = "tmux_2_9")]
pub up: bool,
/// `[-A allow-actions]`
#[cfg(feature = "tmux_3_2")]
pub allow_actions: Option<AllowActions<'a>>,
/// `[-B subscribe]`
#[cfg(feature = "tmux_3_2")]
pub subscribe: Option<Subscribe<'a>>,
/// `[-C size]`
/// `[-C X,Y]` - set the width and height of a control client
/// `[-C XxY]` - set the width and height of a control client
/// `[-C @id:XxY]` - set the width and height of a control client
#[cfg(all(feature = "tmux_2_4"))]
pub size: Option<(usize, usize)>,
/// `[-F flags]`
#[cfg(all(feature = "tmux_3_0a", not(feature = "tmux_3_2")))]
pub flags: Option<ClientFlags>,
/// `[-f flags]`
#[cfg(feature = "tmux_3_2")]
pub flags: Option<ClientFlags>,
/// `[-l [target-pane]]` - request the clipboard from the client using the xterm(1) escape sequence
#[cfg(all(feature = "tmux_3_3"))]
pub request_clipboard: Option<Option<Cow<'a, str>>>,
/// `[-l target-pane]`
#[cfg(feature = "tmux_3_3")]
pub target_pane: Option<Cow<'a, str>>,
/// `[-r osc10-11-responses]`
#[cfg(feature = "tmux_3_5")]
pub osc10_11_responses: Option<Cow<'a, str>>,
/// `[-t target-client]`
#[cfg(feature = "tmux_0_8")]
pub target_client: Option<Cow<'a, str>>,
/// `[adjustment]`
#[cfg(feature = "tmux_2_9")]
pub adjustment: Option<usize>,
}
impl<'a> RefreshClient<'a> {
pub fn new() -> Self {
Default::default()
}
/// `[-c]`
#[cfg(feature = "tmux_2_9")]
pub fn tracking_cursor(mut self) -> Self {
self.tracking_cursor = true;
self
}
/// `[-D]`
#[cfg(feature = "tmux_2_9")]
pub fn down(mut self) -> Self {
self.down = true;
self
}
/// `[-l]`
#[cfg(all(feature = "tmux_2_9", not(feature = "tmux_3_3")))]
pub fn request_clipboard(mut self) -> Self {
self.request_clipboard = true;
self
}
/// `[-L]`
#[cfg(feature = "tmux_2_9")]
pub fn left(mut self) -> Self {
self.left = true;
self
}
/// `[-R]`
#[cfg(feature = "tmux_2_9")]
pub fn right(mut self) -> Self {
self.right = true;
self
}
/// `[-S]`
#[cfg(all(feature = "tmux_1_6"))]
pub fn status_line(mut self) -> Self {
self.status_line = true;
self
}
/// `[-U]`
#[cfg(feature = "tmux_2_9")]
pub fn up(mut self) -> Self {
self.up = true;
self
}
/// `[-A allow-actions]`
#[cfg(feature = "tmux_3_2")]
pub fn allow_actions(mut self, allow_actions: AllowActions<'a>) -> Self {
self.allow_actions = Some(allow_actions);
self
}
/// `[-B subscribe]`
#[cfg(feature = "tmux_3_2")]
pub fn subscribe(mut self, subscribe: Subscribe<'a>) -> Self {
self.subscribe = Some(subscribe);
self
}
/// `[-C size]`
/// `[-C X,Y]` - set the width and height of a control client
/// `[-C XxY]` - set the width and height of a control client
/// `[-C @id:XxY]` - set the width and height of a control client
#[cfg(all(feature = "tmux_2_4"))]
pub fn size(mut self, size: (usize, usize)) -> Self {
self.size = Some(size);
self
}
// XXX: refactor vec?
/// `[-F flags]`
#[cfg(all(feature = "tmux_3_0a", not(feature = "tmux_3_2")))]
pub fn flags(mut self, flags: ClientFlags) -> Self {
self.flags = Some(flags);
self
}
// XXX: refactor vec?
/// `[-f flags]`
#[cfg(feature = "tmux_3_2")]
pub fn flags(mut self, flags: ClientFlags) -> Self {
self.flags = Some(flags);
self
}
/// `[-l]` - request the clipboard from the client using the xterm(1) escape sequence
#[cfg(all(feature = "tmux_3_3"))]
pub fn request_clipboard<S: Into<Cow<'a, str>>>(mut self, target_pane: Option<S>) -> Self {
self.request_clipboard = Some(target_pane.and_then(|t| Some(t.into())));
self
}
/// `[-l target-pane]`
#[cfg(feature = "tmux_3_3")]
pub fn target_pane<S: Into<Cow<'a, str>>>(mut self, target_pane: S) -> Self {
self.target_pane = Some(target_pane.into());
self
}
/// `[-r osc10-11-responses]`
#[cfg(feature = "tmux_3_5")]
pub fn osc10_11_responses<S: Into<Cow<'a, str>>>(mut self, osc10_11_responses: S) -> Self {
self.osc10_11_responses = Some(osc10_11_responses.into());
self
}
/// `[-t target-client]`
#[cfg(feature = "tmux_0_8")]
pub fn target_client<S: Into<Cow<'a, str>>>(mut self, target_client: S) -> Self {
self.target_client = Some(target_client.into());
self
}
/// `[adjustment]`
#[cfg(feature = "tmux_2_9")]
pub fn adjustment(mut self, adjustment: usize) -> Self {
self.adjustment = Some(adjustment);
self
}
/// build command with arguments in right order
pub fn build(self) -> TmuxCommand<'a> {
let mut cmd = TmuxCommand::new();
cmd.name(REFRESH_CLIENT);
// `[-c]`
#[cfg(feature = "tmux_2_9")]
if self.tracking_cursor {
cmd.push_flag(C_LOWERCASE_KEY);
}
// `[-D]`
#[cfg(feature = "tmux_2_9")]
if self.down {
cmd.push_flag(D_UPPERCASE_KEY);
}
// `[-l]`
#[cfg(all(feature = "tmux_2_9", not(feature = "tmux_3_3")))]
if self.request_clipboard {
cmd.push_flag(L_LOWERCASE_KEY);
}
// `[-L]`
#[cfg(feature = "tmux_2_9")]
if self.left {
cmd.push_flag(L_UPPERCASE_KEY);
}
// `[-R]`
#[cfg(feature = "tmux_2_9")]
if self.right {
cmd.push_flag(R_UPPERCASE_KEY);
}
// `[-S]`
#[cfg(all(feature = "tmux_1_6"))]
if self.status_line {
cmd.push_flag(S_UPPERCASE_KEY);
}
// `[-U]`
#[cfg(feature = "tmux_2_9")]
if self.up {
cmd.push_flag(U_UPPERCASE_KEY);
}
// TODO: accept target_pane
// TODO: -A may be given multiple times for different panes
// `[-A pane:state]` - allows a control mode client to trigger actions on a pane
// `[-A allow-actions]`
#[cfg(feature = "tmux_3_2")]
if let Some(allow_actions) = self.allow_actions {
cmd.push_option(A_UPPERCASE_KEY, allow_actions.to_string());
}
// TODO: refactor, accept target_pane, target_window and masks * ...
// TODO: according to man
// `[-B subscribe]`
#[cfg(feature = "tmux_3_2")]
if let Some(subscribe) = self.subscribe {
let mut arg = format!("%{}", subscribe.name);
if let Some(s) = subscribe.what {
arg = format!("{}:{}", arg, s);
if let Some(s) = subscribe.format {
arg = format!("{}:{}", arg, s);
}
}
cmd.push_option(B_UPPERCASE_KEY, arg);
}
// `[-C size]`
// `[-C X,Y]` - set the width and height of a control client
// `[-C XxY]` - set the width and height of a control client
#[cfg(feature = "tmux_2_4")]
if let Some(size) = self.size {
#[cfg(all(feature = "tmux_2_4", not(feature = "tmux_3_0a")))]
let s = format!("{},{}", size.0, size.1);
// FIXME: multiple incompatible def's
#[cfg(all(feature = "tmux_3_0a", not(feature = "tmux_3_3")))]
let s = format!("{}x{}", size.0, size.1);
// FIXME Size Enum + Struct wxh or @window:wxh
#[cfg(feature = "tmux_3_3")]
let s = format!("{}x{}", size.0, size.1);
cmd.push_option(C_UPPERCASE_KEY, s);
}
// XXX: refactor vec?
// `[-f flags]` - sets a comma-separated list of client flags
// `[-F flags]`
#[cfg(all(feature = "tmux_3_0a", not(feature = "tmux_3_2")))]
if let Some(flags) = self.flags {
cmd.push_option(F_UPPERCASE_KEY, flags.to_string());
}
// `[-f flags]`
#[cfg(feature = "tmux_3_2")]
if let Some(flags) = self.flags {
cmd.push_option(F_LOWERCASE_KEY, flags.to_string());
}
// `[-l target-pane]`
#[cfg(feature = "tmux_3_3")]
if let Some(request_clipboard) = self.request_clipboard {
match request_clipboard {
Some(target_pane) => cmd.push_option(L_LOWERCASE_KEY, target_pane),
None => cmd.push_flag(L_LOWERCASE_KEY),
};
}
// `[-r osc10-11-responses]`
#[cfg(feature = "tmux_3_5")]
if let Some(osc10_11_responses) = self.osc10_11_responses {
cmd.push_option(R_LOWERCASE_KEY, osc10_11_responses);
}
// `[-t target-client]`
#[cfg(feature = "tmux_0_8")]
if let Some(target_client) = self.target_client {
cmd.push_option(T_LOWERCASE_KEY, target_client);
}
// `[adjustment]`
#[cfg(feature = "tmux_2_9")]
if let Some(adjustment) = self.adjustment {
cmd.push_param(adjustment.to_string());
}
cmd
}
}