Compare commits
2 commits
f7680216b8
...
a54e5422b4
Author | SHA1 | Date | |
---|---|---|---|
a54e5422b4 | |||
a156009442 |
4 changed files with 21 additions and 8 deletions
15
man/mkwin.1
15
man/mkwin.1
|
@ -6,11 +6,9 @@
|
|||
.Nd generate bash scripts for running Windows programs from WSL
|
||||
.Sh SYNOPSIS
|
||||
.Nm mkwin
|
||||
.Op Fl hq
|
||||
.Op Fl -empty
|
||||
.Op Fl heEq
|
||||
.Op Fl -find Ar root
|
||||
.Op Fl -pc Ar flags
|
||||
.Op Fl -quiet
|
||||
.Ar target
|
||||
.Op Ar --\ args
|
||||
.Sh DESCRIPTION
|
||||
|
@ -20,8 +18,12 @@ 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 -empty
|
||||
.It Fl e , 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 .
|
||||
|
@ -53,7 +55,12 @@ 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mkwin"
|
||||
version = "0.0.5"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
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"];
|
||||
|
|
|
@ -60,6 +60,7 @@ 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);
|
||||
|
||||
// get target executable
|
||||
|
@ -83,7 +84,11 @@ pub fn main() {
|
|||
}
|
||||
|
||||
// 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
|
||||
if !forwarded.is_empty() {
|
||||
|
|
Loading…
Reference in a new issue