mkwin: added env-share flag

This commit is contained in:
Valerie Wolfe 2024-07-22 13:32:16 -04:00
parent f7680216b8
commit a156009442
3 changed files with 10 additions and 4 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "mkwin" name = "mkwin"
version = "0.0.5" version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]

View file

@ -2,6 +2,7 @@
pub const HELP: [&str;2] = ["-h", "--help"]; pub const HELP: [&str;2] = ["-h", "--help"];
pub const EMPTY: [&str;2] = ["-e", "--empty"]; pub const EMPTY: [&str;2] = ["-e", "--empty"];
pub const ENV_SHARE: [&str;2] = ["-E", "--env-share"];
pub const FIND_BIN: &str = "--find"; pub const FIND_BIN: &str = "--find";
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

@ -59,8 +59,9 @@ pub fn main() {
} }
// consume simple flags // consume simple flags
let empty = args.contains(flag::EMPTY); let empty = args.contains(flag::EMPTY);
let quiet = args.contains(flag::QUIET); let env_share = args.contains(flag::ENV_SHARE);
let quiet = args.contains(flag::QUIET);
// get target executable // get target executable
let target: String; let target: String;
@ -83,7 +84,11 @@ pub fn main() {
} }
// construct output // construct output
print!("#!/usr/bin/bash\n# generated with: mkwin{arg_string}\n\n{target}"); println!("#!/usr/bin/bash\n# generated with: mkwin{arg_string}\n");
if env_share { println!("env-share 2> /dev/null\n"); }
print!("{target}");
// handle forwarded arguments // handle forwarded arguments
if !forwarded.is_empty() { if !forwarded.is_empty() {