Compare commits
No commits in common. "087a2fe66e68a5cef009424dbfaa3fa009caceb4" and "fd076f7feee84f33936b502f93d54debf78d7c90" have entirely different histories.
087a2fe66e
...
fd076f7fee
3 changed files with 3 additions and 13 deletions
|
@ -149,13 +149,10 @@ pub fn new(pargs: &mut Arguments) {
|
||||||
// don't allow unflagged nesting
|
// don't allow unflagged nesting
|
||||||
util::prevent_nest();
|
util::prevent_nest();
|
||||||
|
|
||||||
// get optional flags
|
// get optional flag
|
||||||
let detached = pargs.contains(flag::DETACH);
|
let detached = pargs.contains(flag::DETACH);
|
||||||
let target_dir: Result<String, Error> = pargs.value_from_str(flag::TARGET);
|
let target_dir: Result<String, Error> = pargs.value_from_str(flag::TARGET);
|
||||||
|
|
||||||
// get environment variables
|
|
||||||
let window_name = env_var(env::NEW_WINDOW_NAME);
|
|
||||||
|
|
||||||
// get target or fallback
|
// get target or fallback
|
||||||
let args = pargs.clone().finish();
|
let args = pargs.clone().finish();
|
||||||
let title: String;
|
let title: String;
|
||||||
|
@ -174,7 +171,6 @@ pub fn new(pargs: &mut Arguments) {
|
||||||
if let Some(command) = command { new.shell_command = Some(command.to_string_lossy()); }
|
if let Some(command) = command { new.shell_command = Some(command.to_string_lossy()); }
|
||||||
if detached { new.detached = true; }
|
if detached { new.detached = true; }
|
||||||
if let Ok(target_dir) = target_dir { new = new.start_directory(target_dir); }
|
if let Ok(target_dir) = target_dir { new = new.start_directory(target_dir); }
|
||||||
if !window_name.is_empty() { new.window_name = Some(window_name.into()); }
|
|
||||||
|
|
||||||
Tmux::new()
|
Tmux::new()
|
||||||
.add_command(new)
|
.add_command(new)
|
||||||
|
|
|
@ -2,8 +2,7 @@ use std::env::var;
|
||||||
|
|
||||||
pub type EnvVar = (&'static str, &'static str);
|
pub type EnvVar = (&'static str, &'static str);
|
||||||
|
|
||||||
pub static ATTACH_SYMBOL: EnvVar = ("REMUX_ATTACH_SYMBOL", "*");
|
pub static ATTACH_SYMBOL: EnvVar = ("REMUX_ATTACH_SYMBOL", "*");
|
||||||
pub static NEW_WINDOW_NAME: EnvVar = ("REMUX_NEW_WINDOW", "");
|
|
||||||
|
|
||||||
pub fn env_var(envvar: EnvVar) -> String {
|
pub fn env_var(envvar: EnvVar) -> String {
|
||||||
var(envvar.0).unwrap_or(envvar.1.to_string())
|
var(envvar.0).unwrap_or(envvar.1.to_string())
|
||||||
|
|
|
@ -107,12 +107,7 @@ println!("remux environment variables
|
||||||
REMUX_ATTACH_SYMBOL
|
REMUX_ATTACH_SYMBOL
|
||||||
Changes the symbol displayed for attached sessions displayed
|
Changes the symbol displayed for attached sessions displayed
|
||||||
by the 'list' command.
|
by the 'list' command.
|
||||||
Default: '*'
|
Default: '*'"),
|
||||||
|
|
||||||
REMUX_NEW_WINDOW
|
|
||||||
Provides a default window name when creating a session with
|
|
||||||
the 'new' command, if not empty.
|
|
||||||
Default: ''"),
|
|
||||||
|
|
||||||
// not found
|
// not found
|
||||||
_ => error::no_help(topic.unwrap())
|
_ => error::no_help(topic.unwrap())
|
||||||
|
|
Loading…
Reference in a new issue