guedou / cargo-strip

Strip Rust binaries created with cargo
MIT License
90 stars 2 forks source link

UX: cargo-strip binary should be a cargo subcommand ("cargo strip") instead? #8

Closed brainstorm closed 4 years ago

brainstorm commented 4 years ago

Currently first-time users find this:

$ cargo strip
error: Found argument 'strip' which wasn't expected, or isn't valid in this context

USAGE:
    cargo-strip [OPTIONS]

For more information try --help
$ cargo-strip
$

Where, I think, should be like cargo embed, which leverages subcommands, see its usage section for what I mean:

https://github.com/probe-rs/cargo-embed#usage

guedou commented 4 years ago

How did you install cargo-strip? As long as the cargo-stripbinary is in your $PATH, cargo will recognize it as a sub-command.

Could you report the output of rustup show and cargo version?

brainstorm commented 4 years ago

I installed by simply cargo install cargo-strip, since the expected cargo install strip does not work.

What you suggest doesn't seem to work for me, I'm trying it now on a fresh environment you can use too yourself over at https://code.codeonline.io/:

➜  htsget-aws git:(master) which cargo-strip
/rust/.cargo/bin/cargo-strip
➜  htsget-aws git:(master) echo $PATH
/rust/.cargo/bin:/rust/.cargo/bin:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
➜  htsget-aws git:(master) cargo strip
error: Found argument 'strip' which wasn't expected, or isn't valid in this context

USAGE:
    cargo-strip [OPTIONS]

For more information try --help
➜  htsget-aws git:(master) cargo-strip
➜  htsget-aws git:(master) 
➜  htsget-aws git:(master) rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/brainstorm@nopcode.org/.rustup

stable-x86_64-unknown-linux-gnu (default)
rustc 1.44.0 (49cae5576 2020-06-01)
➜  htsget-aws git:(master) cargo version
cargo 1.44.0 (05d080faa 2020-05-06)
guedou commented 4 years ago

Thanks. I was able to reproduce this issue.

guedou commented 4 years ago

PR #9 fixes this issue. Could you try to test it with the following command? cargo install --force --git https://github.com/guedou/cargo-strip --branch subcommand

I don't know why this behavior used to work and is now failing =/

brainstorm commented 4 years ago

Cool, seems to work, merge and ship it to crates.io, please ! ;)

guedou commented 4 years ago

v0.2.3 is now available on crates.io.