Compare commits

..

No commits in common. "a54e5422b4e20a37d4c9f1eea966699db9ed27cf" and "f7680216b85420a2003d50ec6a0ffcd716a2128f" have entirely different histories.

4 changed files with 8 additions and 21 deletions

View file

@ -6,9 +6,11 @@
.Nd generate bash scripts for running Windows programs from WSL
.Sh SYNOPSIS
.Nm mkwin
.Op Fl heEq
.Op Fl hq
.Op Fl -empty
.Op Fl -find Ar root
.Op Fl -pc Ar flags
.Op Fl -quiet
.Ar target
.Op Ar --\ args
.Sh DESCRIPTION
@ -18,12 +20,8 @@ utility generates bash scripts for executing Windows executables from WSL, and p
.Bl -tag -width Ds
.It Ar --\ args
The resulting script will forward the provided arguments.
.It Fl e , Fl -empty
.It Fl -empty
The resulting script will not pass arguments to the target binary.
.It Fl E , Fl -env-share
The resulting script will call the
.Xr env-share 1
utility.
.It Fl -find Ar root
The resulting script will locate the target binary in the given directory using
.Xr find 1 .
@ -55,12 +53,7 @@ Windows Terminal's executable moves when updated. To generate a script to launch
.Pp
.Dl $ mkwin --empty --find='/mnt/c/Program Files/WindowsApps/Microsoft.WindowsTerminal*' WindowsTerminal.exe > terminal.sh
.Pp
PowerShell doesn't inherit environment variables from WSL. To generate a script to call PowerShell with shared variables:
.Pp
.Dl $ mkwin -E '/mnt/c/Program Files/PowerShell/7/pwsh.exe'
.Pp
.Sh SEE ALSO
.Xr env-share 1 ,
.Xr find 1 ,
.Xr path-convert 1
.Sh AUTHORS

View file

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

View file

@ -2,7 +2,6 @@
pub const HELP: [&str;2] = ["-h", "--help"];
pub const EMPTY: [&str;2] = ["-e", "--empty"];
pub const ENV_SHARE: [&str;2] = ["-E", "--env-share"];
pub const FIND_BIN: &str = "--find";
pub const PATH_CONVERT: &str = "--pc";
pub const QUIET: [&str;2] = ["-q", "--quiet"];

View file

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