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
use crate::TmuxCommand;

/// All functions from man tmux "Buffers" listed below
/// ([man tmux](http://man7.org/linux/man-pages/man1/tmux.1.html#BUFFERS))
#[cfg(feature = "tmux_1_3")]
pub mod choose_buffer;
#[cfg(feature = "tmux_1_3")]
pub mod choose_buffer_macro;

#[cfg(feature = "tmux_0_9")]
pub mod clear_history;
#[cfg(feature = "tmux_0_9")]
pub mod clear_history_macro;

//#[cfg(feature = "tmux_1_0")]
//pub mod copy_buffer;
#[cfg(feature = "tmux_0_8")]
pub mod delete_buffer;
#[cfg(feature = "tmux_0_8")]
pub mod delete_buffer_macro;

#[cfg(feature = "tmux_0_8")]
pub mod list_buffers;
#[cfg(feature = "tmux_0_8")]
pub mod list_buffers_macro;

#[cfg(feature = "tmux_0_8")]
pub mod load_buffer;
#[cfg(feature = "tmux_0_8")]
pub mod load_buffer_macro;

#[cfg(feature = "tmux_0_8")]
pub mod paste_buffer;
#[cfg(feature = "tmux_0_8")]
pub mod paste_buffer_macro;

#[cfg(feature = "tmux_0_8")]
pub mod save_buffer;
#[cfg(feature = "tmux_0_8")]
pub mod save_buffer_macro;

#[cfg(feature = "tmux_0_8")]
pub mod set_buffer;
#[cfg(feature = "tmux_0_8")]
pub mod set_buffer_macro;

#[cfg(feature = "tmux_0_8")]
pub mod show_buffer;
#[cfg(feature = "tmux_0_8")]
pub mod show_buffer_macro;

#[cfg(feature = "tmux_1_3")]
pub use choose_buffer::ChooseBuffer;
#[cfg(feature = "tmux_0_9")]
pub use clear_history::{ClearHist, ClearHistory};
//#[cfg(feature = "tmux_1_0")]
//pub use copy_buffer::CopyBuffer;
#[cfg(feature = "tmux_0_8")]
pub use delete_buffer::{DeleteB, DeleteBuffer};
#[cfg(feature = "tmux_0_8")]
pub use list_buffers::{ListBuffers, LsB};
#[cfg(feature = "tmux_0_8")]
pub use load_buffer::{LoadB, LoadBuffer};
#[cfg(feature = "tmux_0_8")]
pub use paste_buffer::{PasteB, PasteBuffer};
#[cfg(feature = "tmux_0_8")]
pub use save_buffer::{SaveB, SaveBuffer};
#[cfg(feature = "tmux_0_8")]
pub use set_buffer::{SetB, SetBuffer};
#[cfg(feature = "tmux_0_8")]
pub use show_buffer::{ShowB, ShowBuffer};

//#[cfg(feature = "tmux_1_3")]
//use self::ChooseBuffer;

#[cfg(test)]
#[path = "."]
mod buffers_tests {
    #[cfg(feature = "tmux_1_3")]
    mod choose_buffer_tests;
    #[cfg(feature = "tmux_0_9")]
    mod clear_history_tests;
    // XXX: versions check
    //#[cfg(feature = "tmux_1_0")]
    //pub mod copy_buffer_tests;
    #[cfg(feature = "tmux_0_8")]
    mod delete_buffer_tests;
    #[cfg(feature = "tmux_0_8")]
    mod list_buffers_tests;
    #[cfg(feature = "tmux_0_8")]
    mod load_buffer_tests;
    #[cfg(feature = "tmux_0_8")]
    mod paste_buffer_tests;
    #[cfg(feature = "tmux_0_8")]
    mod save_buffer_tests;
    #[cfg(feature = "tmux_0_8")]
    mod set_buffer_tests;
    #[cfg(feature = "tmux_0_8")]
    mod show_buffer_tests;
}

/// All functions from man tmux "Buffers" listed below
/// ([man tmux](http://man7.org/linux/man-pages/man1/tmux.1.html#BUFFERS))
impl<'a> TmuxCommand<'a> {
    #[cfg(feature = "tmux_1_3")]
    pub fn choose_buffer() -> ChooseBuffer<'a> {
        ChooseBuffer::new()
    }

    #[cfg(feature = "tmux_0_9")]
    pub fn clear_history() -> ClearHistory<'a> {
        ClearHistory::new()
    }

    #[cfg(feature = "tmux_0_8")]
    pub fn delete_buffer() -> DeleteBuffer<'a> {
        DeleteBuffer::new()
    }

    #[cfg(feature = "tmux_0_8")]
    pub fn list_buffers() -> ListBuffers<'a> {
        ListBuffers::new()
    }

    #[cfg(feature = "tmux_0_8")]
    pub fn load_buffer() -> LoadBuffer<'a> {
        LoadBuffer::new()
    }

    #[cfg(feature = "tmux_0_8")]
    pub fn paste_buffer() -> PasteBuffer<'a> {
        PasteBuffer::new()
    }

    #[cfg(feature = "tmux_0_8")]
    pub fn save_buffer() -> SaveBuffer<'a> {
        SaveBuffer::new()
    }

    #[cfg(feature = "tmux_0_8")]
    pub fn set_buffer() -> SetBuffer<'a> {
        SetBuffer::new()
    }

    #[cfg(feature = "tmux_0_8")]
    pub fn show_buffer() -> ShowBuffer<'a> {
        ShowBuffer::new()
    }
}

// XXX: generic
#[cfg(feature = "tmux_1_3")]
impl<'a> From<ChooseBuffer<'a>> for TmuxCommand<'a> {
    fn from(item: ChooseBuffer<'a>) -> Self {
        item.build()
    }
}

#[cfg(feature = "tmux_0_9")]
impl<'a> From<ClearHistory<'a>> for TmuxCommand<'a> {
    fn from(item: ClearHistory<'a>) -> Self {
        item.build()
    }
}

#[cfg(feature = "tmux_0_8")]
impl<'a> From<DeleteBuffer<'a>> for TmuxCommand<'a> {
    fn from(item: DeleteBuffer<'a>) -> Self {
        item.build()
    }
}

#[cfg(feature = "tmux_0_8")]
impl<'a> From<ListBuffers<'a>> for TmuxCommand<'a> {
    fn from(item: ListBuffers<'a>) -> Self {
        item.build()
    }
}

#[cfg(feature = "tmux_0_8")]
impl<'a> From<LoadBuffer<'a>> for TmuxCommand<'a> {
    fn from(item: LoadBuffer<'a>) -> Self {
        item.build()
    }
}

#[cfg(feature = "tmux_0_8")]
impl<'a> From<PasteBuffer<'a>> for TmuxCommand<'a> {
    fn from(item: PasteBuffer<'a>) -> Self {
        item.build()
    }
}

#[cfg(feature = "tmux_0_8")]
impl<'a> From<SaveBuffer<'a>> for TmuxCommand<'a> {
    fn from(item: SaveBuffer<'a>) -> Self {
        item.build()
    }
}

#[cfg(feature = "tmux_0_8")]
impl<'a> From<SetBuffer<'a>> for TmuxCommand<'a> {
    fn from(item: SetBuffer<'a>) -> Self {
        item.build()
    }
}

#[cfg(feature = "tmux_0_8")]
impl<'a> From<ShowBuffer<'a>> for TmuxCommand<'a> {
    fn from(item: ShowBuffer<'a>) -> Self {
        item.build()
    }
}