From a3b3dce376d036290a3aea47757790b87417c47d Mon Sep 17 00:00:00 2001 From: Valerie Wolfe Date: Tue, 11 Jun 2024 11:29:57 -0400 Subject: [PATCH] mkwin: added empty flag to not pass $@ --- mkwin/src/flag.rs | 1 + mkwin/src/main.rs | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/mkwin/src/flag.rs b/mkwin/src/flag.rs index 39ebb0b..9b56f5b 100644 --- a/mkwin/src/flag.rs +++ b/mkwin/src/flag.rs @@ -1,6 +1,7 @@ //! constants for flag arguments pub const HELP: [&str;2] = ["-h", "--help"]; +pub const EMPTY: &str = "--empty"; pub const PATH_CONVERT: &str = "--pc"; pub const QUIET: [&str;2] = ["-q", "--quiet"]; diff --git a/mkwin/src/main.rs b/mkwin/src/main.rs index 8110621..374fb5f 100644 --- a/mkwin/src/main.rs +++ b/mkwin/src/main.rs @@ -52,6 +52,7 @@ pub fn main() { } // consume simple flags + let empty = args.contains(flag::EMPTY); let quiet = args.contains(flag::QUIET); // get target executable @@ -77,12 +78,15 @@ pub fn main() { print!("{forwarded}"); } - // handle path convert flag - if path_convert { - let flags = if let Some(i) = path_convert_flags { format!(" -{i}") } else { String::new() }; - print!(" `path-convert{flags} $@`"); - } else { - print!(" $@"); + // handle empty flag + if !empty { + // handle path convert flag + if path_convert { + let flags = if let Some(i) = path_convert_flags { format!(" -{i}") } else { String::new() }; + print!(" `path-convert{flags} $@`"); + } else { + print!(" $@"); + } } // handle quiet flag @@ -106,9 +110,11 @@ args: flags: -h, --help Shows this help text and exit. + --empty The resulting script will not pass arguments. + --pc= The resulting script will use the 'path-convert' to convert arguments from UNIX to DOS, with the provided set of flags - ('x' for no flags). + ('x' for no flags). -q, --quiet The resulting script will run the target program in the background and with its outputs redirected to '/dev/null'.",