mkwin: added empty flag to not pass $@

This commit is contained in:
Valerie Wolfe 2024-06-11 11:29:57 -04:00
parent 5386fbdf63
commit a3b3dce376
2 changed files with 14 additions and 7 deletions

View file

@ -1,6 +1,7 @@
//! constants for flag arguments //! constants for flag arguments
pub const HELP: [&str;2] = ["-h", "--help"]; pub const HELP: [&str;2] = ["-h", "--help"];
pub const EMPTY: &str = "--empty";
pub const PATH_CONVERT: &str = "--pc"; pub const PATH_CONVERT: &str = "--pc";
pub const QUIET: [&str;2] = ["-q", "--quiet"]; pub const QUIET: [&str;2] = ["-q", "--quiet"];

View file

@ -52,6 +52,7 @@ pub fn main() {
} }
// consume simple flags // consume simple flags
let empty = args.contains(flag::EMPTY);
let quiet = args.contains(flag::QUIET); let quiet = args.contains(flag::QUIET);
// get target executable // get target executable
@ -77,6 +78,8 @@ pub fn main() {
print!("{forwarded}"); print!("{forwarded}");
} }
// handle empty flag
if !empty {
// handle path convert flag // handle path convert flag
if path_convert { if path_convert {
let flags = if let Some(i) = path_convert_flags { format!(" -{i}") } else { String::new() }; let flags = if let Some(i) = path_convert_flags { format!(" -{i}") } else { String::new() };
@ -84,6 +87,7 @@ pub fn main() {
} else { } else {
print!(" $@"); print!(" $@");
} }
}
// handle quiet flag // handle quiet flag
if quiet { if quiet {
@ -106,6 +110,8 @@ args:
flags: flags:
-h, --help Shows this help text and exit. -h, --help Shows this help text and exit.
--empty The resulting script will not pass arguments.
--pc=<flags> The resulting script will use the 'path-convert' to convert --pc=<flags> The resulting script will use the 'path-convert' to convert
arguments from UNIX to DOS, with the provided set of flags arguments from UNIX to DOS, with the provided set of flags
('x' for no flags). ('x' for no flags).