From aa4c26ba4c4a0914217a217927008e3af1a6816b Mon Sep 17 00:00:00 2001 From: Valerie Date: Fri, 8 Mar 2024 13:58:48 -0500 Subject: [PATCH] renamed detach flag and added detach support to 'new' --- src/command/share.rs | 4 +++- src/flag.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/command/share.rs b/src/command/share.rs index 1bf96ab..3523afa 100644 --- a/src/command/share.rs +++ b/src/command/share.rs @@ -20,7 +20,7 @@ pub fn attach(pargs: &mut Arguments) { // consume optional flags let read_only = pargs.contains(flag::READ_ONLY); - let detach_other = pargs.contains(flag::DETACHED); + let detach_other = pargs.contains(flag::DETACH); let args = pargs.clone().finish(); let target: String; @@ -146,6 +146,7 @@ pub fn new(pargs: &mut Arguments) { util::prevent_nest(); // get optional flag + let detached = pargs.contains(flag::DETACH); let target_dir: Result = pargs.value_from_str(flag::TARGET); // get target or fallback @@ -164,6 +165,7 @@ pub fn new(pargs: &mut Arguments) { let mut new = commands::NewSession::new(); new = new.group_name(title); if let Some(command) = command { new.shell_command = Some(command.to_string_lossy()); } + if detached { new.detached = true; } if let Ok(target_dir) = target_dir { new = new.start_directory(target_dir); } Tmux::new() diff --git a/src/flag.rs b/src/flag.rs index 92056f3..4c7066d 100644 --- a/src/flag.rs +++ b/src/flag.rs @@ -1,7 +1,7 @@ type Flag = [&'static str;2]; -pub static DETACHED: Flag = ["-d", "--detached"]; +pub static DETACH: Flag = ["-d", "--detach"]; pub static HELP: Flag = ["-h", "--help"]; pub static NEST: Flag = ["-n", "--nest"]; pub static QUIET: Flag = ["-q", "--quiet"];