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
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"];

View file

@ -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=<flags> 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'.",