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

/// All functions from man tmux "Key Bindings" listed below
/// ([man tmux](http://man7.org/linux/man-pages/man1/tmux.1.html#KEY_BINDINGS))
#[cfg(feature = "tmux_0_8")]
pub mod bind_key;
// FIXME
//#[cfg(feature = "tmux_0_8")]
//pub mod bind_key_macro;

#[cfg(feature = "tmux_0_8")]
pub mod list_keys;
#[cfg(feature = "tmux_0_8")]
pub mod list_keys_macro;

#[cfg(feature = "tmux_0_8")]
pub mod send_keys;
#[cfg(feature = "tmux_0_8")]
pub mod send_keys_macro;

#[cfg(feature = "tmux_0_8")]
pub mod send_prefix;
#[cfg(feature = "tmux_0_8")]
pub mod send_prefix_macro;

#[cfg(feature = "tmux_0_8")]
pub mod unbind_key;
#[cfg(feature = "tmux_0_8")]
pub mod unbind_key_macro;

#[cfg(feature = "tmux_0_8")]
pub use bind_key::BindKey;
#[cfg(feature = "tmux_0_8")]
pub use list_keys::ListKeys;
#[cfg(feature = "tmux_0_8")]
pub use send_keys::SendKeys;
#[cfg(feature = "tmux_0_8")]
pub use send_prefix::SendPrefix;
#[cfg(feature = "tmux_0_8")]
pub use unbind_key::UnbindKey;

#[cfg(test)]
#[path = "."]
mod key_bindings_tests {
    #[cfg(feature = "tmux_0_8")]
    pub mod bind_key_tests;
    #[cfg(feature = "tmux_0_8")]
    pub mod list_keys_tests;
    #[cfg(feature = "tmux_0_8")]
    pub mod send_keys_tests;
    #[cfg(feature = "tmux_0_8")]
    pub mod send_prefix_tests;
    #[cfg(feature = "tmux_0_8")]
    pub mod unbind_key_tests;
}

/// All functions from man tmux "Key Bindings" listed below
/// ([man tmux](http://man7.org/linux/man-pages/man1/tmux.1.html#KEY_BINDINGS))
impl<'a> TmuxCommand<'a> {
    #[cfg(feature = "tmux_0_8")]
    pub fn bind_key() -> BindKey<'a> {
        BindKey::new()
    }

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

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

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

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

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

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

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

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

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