use crate::options::server::common::constants::*;
use crate::{SetClipboard, SetOptionTr, SetUserOption, Switch, TmuxCommand, TmuxCommands};
use std::borrow::Cow;
pub trait SetServerOptionTr: SetOptionTr + SetUserOption {
#[cfg(feature = "tmux_3_1")]
fn backspace<'a, S: Into<Cow<'a, str>>>(backspace: Option<S>) -> TmuxCommand<'a> {
Self::set(BACKSPACE, backspace)
}
#[cfg(feature = "tmux_1_5")]
fn buffer_limit<'a>(buffer_limit: Option<usize>) -> TmuxCommand<'a> {
Self::set(BUFFER_LIMIT, buffer_limit.map(|s| s.to_string()))
}
#[cfg(feature = "tmux_2_4")]
fn command_alias<'a, I, S>(command_alias: Option<I>) -> TmuxCommands<'a>
where
I: IntoIterator<Item = S>,
S: Into<Cow<'a, str>>,
{
Self::set_array(COMMAND_ALIAS, command_alias)
}
#[cfg(feature = "tmux_2_4")]
fn command_alias_ext<'a, S: Into<Cow<'a, str>>>(
i: usize,
command_alias: Option<S>,
) -> TmuxCommand<'a> {
Self::set(format!("{}[{}]", COMMAND_ALIAS, i), command_alias)
}
#[cfg(feature = "tmux_3_2")]
fn copy_command<'a, S: Into<Cow<'a, str>>>(copy_command: Option<S>) -> TmuxCommand<'a> {
Self::set(COPY_COMMAND, copy_command)
}
#[cfg(feature = "tmux_2_1")]
fn default_terminal<'a, S: Into<Cow<'a, str>>>(default_terminal: Option<S>) -> TmuxCommand<'a> {
Self::set(DEFAULT_TERMINAL, default_terminal)
}
#[cfg(feature = "tmux_1_2")]
fn escape_time<'a>(escape_time: Option<usize>) -> TmuxCommand<'a> {
Self::set(ESCAPE_TIME, escape_time.map(|s| s.to_string()))
}
#[cfg(feature = "tmux_3_2")]
fn editor<'a, S: Into<Cow<'a, str>>>(editor: Option<S>) -> TmuxCommand<'a> {
Self::set(EDITOR, editor)
}
#[cfg(feature = "tmux_2_7")]
fn exit_empty<'a>(exit_empty: Option<Switch>) -> TmuxCommand<'a> {
Self::set(EXIT_EMPTY, exit_empty.map(|s| s.to_string()))
}
#[cfg(feature = "tmux_1_4")]
fn exit_unattached<'a>(exit_unattached: Option<Switch>) -> TmuxCommand<'a> {
Self::set(EXIT_UNATTACHED, exit_unattached.map(|s| s.to_string()))
}
#[cfg(feature = "tmux_3_2")]
fn extended_keys<'a>(extended_keys: Option<Switch>) -> TmuxCommand<'a> {
Self::set(EXTENDED_KEYS, extended_keys.map(|s| s.to_string()))
}
#[cfg(feature = "tmux_1_9")]
fn focus_events<'a>(focus_events: Option<Switch>) -> TmuxCommand<'a> {
Self::set(FOCUS_EVENTS, focus_events.map(|s| s.to_string()))
}
#[cfg(feature = "tmux_2_1")]
fn history_file<'a, S: Into<Cow<'a, str>>>(history_file: Option<S>) -> TmuxCommand<'a> {
Self::set(HISTORY_FILE, history_file)
}
#[cfg(feature = "tmux_2_0")]
fn message_limit<'a>(message_limit: Option<usize>) -> TmuxCommand<'a> {
Self::set(MESSAGE_LIMIT, message_limit.map(|s| s.to_string()))
}
#[cfg(feature = "tmux_3_3")]
fn prompt_history_limit<'a>(prompt_history_limit: Option<usize>) -> TmuxCommand<'a> {
Self::set(
PROMPT_HISTORY_LIMIT,
prompt_history_limit.map(|s| s.to_string()),
)
}
#[cfg(feature = "tmux_1_5")]
fn set_clipboard<'a>(set_clipboard: Option<SetClipboard>) -> TmuxCommand<'a> {
Self::set(SET_CLIPBOARD, set_clipboard.map(|s| s.to_string()))
}
#[cfg(feature = "tmux_3_2")]
fn terminal_features<'a, I, S>(terminal_features: Option<I>) -> TmuxCommands<'a>
where
I: IntoIterator<Item = S>,
S: Into<Cow<'a, str>>,
{
Self::set_array(TERMINAL_FEATURES, terminal_features)
}
#[cfg(feature = "tmux_2_0")]
fn terminal_overrides<'a, I, S>(terminal_overrides: Option<I>) -> TmuxCommands<'a>
where
I: IntoIterator<Item = S>,
S: Into<Cow<'a, str>>,
{
Self::set_array(TERMINAL_OVERRIDES, terminal_overrides)
}
#[cfg(feature = "tmux_3_0")]
fn user_keys<'a, I, S>(user_keys: Option<I>) -> TmuxCommands<'a>
where
I: IntoIterator<Item = S>,
S: Into<Cow<'a, str>>,
{
Self::set_array(USER_KEYS, user_keys)
}
#[cfg(all(feature = "tmux_1_2", not(feature = "tmux_2_0")))]
fn quiet<'a>(quiet: Option<Switch>) -> TmuxCommand<'a> {
Self::set(QUIET, quiet.map(|s| s.to_string()))
}
#[cfg(all(feature = "tmux_1_3", not(feature = "tmux_1_4")))]
fn detach_on_destroy<'a>(detach_on_destroy: Option<Switch>) -> TmuxCommand<'a> {
Self::set(DETACH_ON_DESTROY, detach_on_destroy.map(|s| s.to_string()))
}
}