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
//! The [`commands`][`crate::commands`] module contains functions for building and executing
//! tmux commands
//!
//! # On This Page
//! * 1. [Description](#1-description)
//! * 2. [Quick Start](#2-quick-start)
//! * 3. [Modules Overview](#4-modules-overview)
//!
//! * Command Builder
//!     * Direct Fields Initialization
//!     * Direct Instantiating
//!     * Using Builder Methods
//!     * Using Macros
//!     
//! Direct Initialization of Structure Fields
//! ```
//! use tmux_interface::Tmux;
//!
//! let mut tmux = Tmux::new();
//! tmux.verbose_logging = true;
//!
//! ```
//!
//! ```
//! use tmux_interface::Tmux;
//!
//! let tmux = Tmux {
//!     verbose_logging: true,
//!     ..Default::default()
//! };
//! ```
//!
//! Using Builder Methods
//!
//!
//! * Command Builder
//!     * One-liner
//!         * Autonomous
//!         * Binary
//!     * Multi-liner
//!         * Autonomous
//!         * Binary
//!
//! # Tmux Commands
//!
//! ## Example
//!
//! ```text
//! tmux [-2CluvV] [-c shell-command] [-f file] [-L socket-name] [-S socket-path]
//! [command [flags]]
//! ```
//!
//! * [`tmux`] - tmux binary command and it's arguments
//! * [`tmux_command`] - wrapper for [`std::process::Command`] type
//! * [`tmux_commands`] - wrapper for vector of [`std::process::Command`] type
//! * [`NewSession`] - tmux autonomous command
//!
//!
//!
//! ```text
//! NewSession::new() -> NewSession -> .build() -> TmuxCommand
//!
//! Tmux::new() -> Tmux -> .build() -> TmuxCommand
//! (only tmux can be passed to std::process::Command)
//! ```
//!
//! For convenience all tmux commands builder are splitted in sub-modules by the
//! similar principle as in tmux manual:
//! * [Buffers](buffers)
//! * [Client and Sessions](clients_and_sessions)
//! * [Global and Session Environment](global_and_session_environment)
//! * [Hooks](hooks)
//! * [Key Bindings](key_bindings)
//! * [Miscellaneous](miscellaneous)
//! * [Options](options)
//! * [Status Line](status_line)
//! * [Windows and Panes](windows_and_panes)
//!
//! # Overview
//!
//! Tmux commands
//! * single
//!     * autonomous
//!     * binary
//! * multiple
//!     * autonomous
//!     * binary
//!
//!
//! autonomous/binary - tmux commands can be called from outside of tmux (building one command
//! sequence with tmux binary name) or from inside of tmux
//!
//!
//! multiple/single - tmux commands can be called as a single one or can be chained (similar as in shell)
//!
//!
//! # Single autonomous tmux command
//!
//! Single tmux commands can be separated in two types:
//!
//! * **autonomous tmux command**, just a command itself and it's arguments, used for invoking from
//! inside of tmux
//!
//! ## Example
//!
//! ```text
//! new-session -d -n name
//! ```
//!
//! ```
//! use tmux_interface::NewSession;
//!
//! let new_session = NewSession::new().detached().session_name("my_session").build();
//! ```
//!
//! * **binary tmux command**, a command including tmux binary name and it's arguments used for
//! invoking from outside of tmux
//!
//! ## Example
//!
//! ```text
//! tmux -v new-session -d -n name
//! ```
//!
//! ```
//! use tmux_interface::{Tmux, NewSession};
//!
//! let tmux = Tmux::with_command(
//!              NewSession::new()
//!                .detached()
//!                .session_name("my_session"))
//!              .verbose_logging()
//!              .build();
//! ```
//!
//! # Multiple tmux commands
//!
//! And multiple tmux commands can be combined:
//!
//! * multiple tmux commands
//!
//! ## Example
//!
//! ```text
//! new-session -d -n name ; attach-session -t name
//! ```
//!
//! ```
//! use tmux_interface::TmuxCommands;
//!
//! let cmds = TmuxCommands::new();
//! ```
//!
//! * multiple tmux binary commands
//!
//! ## Example
//!
//! ```text
//! tmux new-session -d -n name ; tmux attach-session -t name
//! ```
//!
//! ```
//! use tmux_interface::{Tmux, TmuxCommands};
//!
//! let cmds = Tmux::new().verbose_logging().commands(TmuxCommands::new());
//! ```
//!
//! # See Also:
//! * [Tmux Manual -> Commands](https://man7.org/linux/man-pages/man1/tmux.1.html#COMMANDS)
//!
pub mod common;

pub mod constants;

pub mod tmux;
pub mod tmux_macro;

pub mod tmux_command;
pub mod tmux_commands;
pub mod tmux_output;

#[cfg(test)]
#[path = "."]
mod commands_tests {
    mod tmux_command_tests;
    mod tmux_commands_tests;
    mod tmux_tests;
}

pub mod buffers;
pub mod clients_and_sessions;
pub mod global_and_session_environment;
pub mod hooks;
pub mod key_bindings;
pub mod miscellaneous;
pub mod options;
pub mod status_line;
pub mod windows_and_panes;

pub use common::*;

// buffers
pub use buffers::*;
// clients and sessions
pub use clients_and_sessions::*;
// global and session environment
pub use global_and_session_environment::*;
// hooks
pub use hooks::*;
// key bindings
pub use key_bindings::*;
// miscellaneous
pub use miscellaneous::*;
// options
pub use options::*;
// status line
pub use status_line::*;
// windows and panes
pub use windows_and_panes::*;

pub use tmux::{StdIO, Tmux};
pub use tmux_command::TmuxCommand;
pub use tmux_commands::TmuxCommands;
pub use tmux_output::TmuxOutput;

// XXX: ?
/// ([man tmux](http://man7.org/linux/man-pages/man1/tmux.1.html))
impl<'a> TmuxCommand<'a> {
    pub fn tmux() -> Tmux<'a> {
        Tmux::new()
    }
}