Skip to content

Commit

Permalink
Powershell
Browse files Browse the repository at this point in the history
  • Loading branch information
bbqsrc committed Apr 12, 2024
1 parent afb554e commit 79735be
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Changelog

### v3.5.3 - 2024-04-12

- Enhancement: add usage instructions to the ndk-env output
- Enhancement: add `--powershell` flag to ndk-env

### v3.5.2 - 2024-04-11

- Fix: make `CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER` correct
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-ndk"
version = "3.5.2"
version = "3.5.3"
authors = ["Brendan Molloy <[email protected]>"]
repository = "https://github.com/bbqsrc/cargo-ndk"
documentation = "https://docs.rs/cargo-ndk"
Expand Down
13 changes: 13 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ struct ArgsEnv {
)]
target: Target,

#[options(no_short, help = "use PowerShell syntax")]
powershell: bool,

#[options(no_short, help = "print output in JSON format")]
json: bool,
}
Expand Down Expand Up @@ -362,10 +365,20 @@ pub fn run_env(args: Vec<String>) -> anyhow::Result<()> {
)
.unwrap()
);
} else if args.powershell {
for (k, v) in env {
println!("${{env:{}}}={:?}", k, v);
}
println!();
println!("# To import with PowerShell:");
println!("# cargo ndk-env --powershell | Out-String | Invoke-Expression");
} else {
for (k, v) in env {
println!("export {}={:?}", k.to_uppercase().replace('-', "_"), v);
}
println!();
println!("# To import with bash/zsh/etc:");
println!("# source <(cargo ndk-env)");
}

Ok(())
Expand Down

0 comments on commit 79735be

Please sign in to comment.