tmux_interface/options/common/user_option/
get_user_option.rs

1use crate::options::{GetOptionTr, USER_OPTION_MARKER};
2use crate::TmuxCommand;
3use std::borrow::Cow;
4
5pub trait GetUserOption: GetOptionTr {
6    fn user_option<'a, S>(name: S) -> TmuxCommand<'a>
7    where
8        S: Into<Cow<'a, str>>,
9    {
10        Self::get(format!("{}{}", USER_OPTION_MARKER, name.into()))
11    }
12
13    /// # Manual
14    ///
15    /// ```text
16    /// @user-option-name value
17    /// ```
18    fn user_option_ext<'a, T, S>(target: Option<T>, name: S) -> TmuxCommand<'a>
19    where
20        T: Into<Cow<'a, str>>,
21        S: Into<Cow<'a, str>>,
22    {
23        Self::get_ext(target, format!("{}{}", USER_OPTION_MARKER, name.into()))
24    }
25}