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

View file

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

View file

@ -2,7 +2,6 @@
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

@ -60,7 +60,6 @@ pub fn main() {
// consume simple flags // consume simple flags
let empty = args.contains(flag::EMPTY); let empty = args.contains(flag::EMPTY);
let env_share = args.contains(flag::ENV_SHARE);
let quiet = args.contains(flag::QUIET); let quiet = args.contains(flag::QUIET);
// get target executable // get target executable
@ -84,11 +83,7 @@ pub fn main() {
} }
// construct output // construct output
println!("#!/usr/bin/bash\n# generated with: mkwin{arg_string}\n"); print!("#!/usr/bin/bash\n# generated with: mkwin{arg_string}\n\n{target}");
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() {