tmux_interface 0.4.0

Rust language library for communication with TMUX via CLI
Documentation
use crate::options::{GetOptionTr, GetUserOption, GetWindowOptionTr};
use crate::{ShowOptions, TmuxCommand};
use std::borrow::Cow;

pub struct GetLocalWindowOption;

impl GetWindowOptionTr for GetLocalWindowOption {}

impl GetUserOption for GetLocalWindowOption {}

impl GetOptionTr for GetLocalWindowOption {
    fn get_ext<'a, T: Into<Cow<'a, str>>, S: Into<Cow<'a, str>>>(
        target: Option<S>,
        name: T,
    ) -> TmuxCommand<'a> {
        let cmd = ShowOptions::new().window().option(name);
        let cmd = match target {
            #[cfg(all(feature = "tmux_0_8", not(feature = "tmux_3_0a")))]
            Some(target) => cmd.target_session(target),
            #[cfg(feature = "tmux_3_0a")]
            Some(target) => cmd.target_pane(target),
            None => cmd,
        };
        cmd.build()
    }

    fn get_all<'a, S: Into<Cow<'a, str>>>(target: Option<S>) -> TmuxCommand<'a> {
        let cmd = ShowOptions::new().window();
        let cmd = match target {
            #[cfg(all(feature = "tmux_0_8", not(feature = "tmux_3_0a")))]
            Some(target) => cmd.target_session(target),
            #[cfg(feature = "tmux_3_0a")]
            Some(target) => cmd.target_pane(target),
            None => cmd,
        };
        cmd.build()
    }
}