mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 21:48:42 +00:00
Fix parsing in entry
: Use std::env::args_os
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
764a960c90
commit
2ea341381d
1 changed files with 2 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
use std::{
|
use std::{
|
||||||
|
ffi::OsString,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::{ExitCode, Termination},
|
process::{ExitCode, Termination},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
|
@ -133,7 +134,7 @@ async fn entry() -> Result<()> {
|
||||||
// Filter extraneous arg when invoked by cargo
|
// Filter extraneous arg when invoked by cargo
|
||||||
// `cargo run -- --help` gives ["target/debug/cargo-binstall", "--help"]
|
// `cargo run -- --help` gives ["target/debug/cargo-binstall", "--help"]
|
||||||
// `cargo binstall --help` gives ["/home/ryan/.cargo/bin/cargo-binstall", "binstall", "--help"]
|
// `cargo binstall --help` gives ["/home/ryan/.cargo/bin/cargo-binstall", "binstall", "--help"]
|
||||||
let mut args: Vec<String> = std::env::args().collect();
|
let mut args: Vec<OsString> = std::env::args_os().collect();
|
||||||
if args.len() > 1 && args[1] == "binstall" {
|
if args.len() > 1 && args[1] == "binstall" {
|
||||||
args.remove(1);
|
args.remove(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue