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
// auto-generated file
//
use crate::commands::constants::*;
use crate::TmuxCommand;
use std::borrow::Cow;
pub type Source<'a> = SourceFile<'a>;
/// Execute commands from path
///
/// # Manual
///
/// tmux >=3.4:
/// ```text
/// source-file [-Fnqv] [-t target-pane] path ...
/// (alias: source)
/// ```
///
/// tmux >=3.2:
/// ```text
/// source-file [-Fnqv] path ...
/// (alias: source)
/// ```
///
/// tmux >=3.0a:
/// ```text
/// source-file [-nqv] path
/// (alias: source)
/// ```
///
/// tmux >=3.0:
/// ```text
/// source-file [-nq] path
/// (alias: source)
/// ```
///
/// tmux >=2.3:
/// ```text
/// source-file [-q] path
/// (alias: source)
///
/// ```
/// tmux >=0.8:
/// ```text
/// source-file path
/// (alias: source)
/// ```
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
pub struct SourceFile<'a> {
/// `[-F]`
#[cfg(feature = "tmux_3_2")]
pub expand: bool,
/// `[-n]`
#[cfg(feature = "tmux_3_0")]
pub not_exclude: bool,
/// `[-q]`
#[cfg(feature = "tmux_2_3")]
pub quiet: bool,
/// `[-v]`
#[cfg(feature = "tmux_3_0a")]
pub verbose: bool,
/// `[-t target-pane]`
#[cfg(feature = "tmux_3_4")]
pub target_pane: Option<Cow<'a, str>>,
/// `[path]`
#[cfg(feature = "tmux_0_8")]
pub path: Option<Cow<'a, str>>,
}
impl<'a> SourceFile<'a> {
pub fn new() -> Self {
Default::default()
}
/// `[-F]`
#[cfg(feature = "tmux_3_2")]
pub fn expand(mut self) -> Self {
self.expand = true;
self
}
/// `[-n]`
#[cfg(feature = "tmux_3_0")]
pub fn not_exclude(mut self) -> Self {
self.not_exclude = true;
self
}
/// `[-q]`
#[cfg(feature = "tmux_2_3")]
pub fn quiet(mut self) -> Self {
self.quiet = true;
self
}
/// `[-v]`
#[cfg(feature = "tmux_3_0a")]
pub fn verbose(mut self) -> Self {
self.verbose = true;
self
}
/// `[-t target-pane]`
#[cfg(feature = "tmux_3_4")]
pub fn target_pane<S: Into<Cow<'a, str>>>(mut self, target_pane: S) -> Self {
self.target_pane = Some(target_pane.into());
self
}
/// `[path]`
#[cfg(feature = "tmux_0_8")]
pub fn path<S: Into<Cow<'a, str>>>(mut self, path: S) -> Self {
self.path = Some(path.into());
self
}
/// build command with arguments in right order
pub fn build(self) -> TmuxCommand<'a> {
let mut cmd = TmuxCommand::new();
cmd.name(SOURCE_FILE);
// `[-F]`
#[cfg(feature = "tmux_3_2")]
if self.expand {
cmd.push_flag(F_UPPERCASE_KEY);
}
// `[-n]`
#[cfg(feature = "tmux_3_0")]
if self.not_exclude {
cmd.push_flag(N_LOWERCASE_KEY);
}
// `[-q]`
#[cfg(feature = "tmux_2_3")]
if self.quiet {
cmd.push_flag(Q_LOWERCASE_KEY);
}
// `[-v]`
#[cfg(feature = "tmux_3_0a")]
if self.verbose {
cmd.push_flag(V_LOWERCASE_KEY);
}
// `[-t target-pane]`
#[cfg(feature = "tmux_3_4")]
if let Some(target_pane) = self.target_pane {
cmd.push_option(T_LOWERCASE_KEY, target_pane);
}
// `[path]`
#[cfg(feature = "tmux_0_8")]
if let Some(path) = self.path {
cmd.push_param(path);
}
cmd
}
}