argh icon indicating copy to clipboard operation
argh copied to clipboard

Only display name of binary

Open Geobert opened this issue 4 years ago • 5 comments

I'm having a weird issue with the generated help message: the command is with it's absolute path when I run ./target/debug/mycmd --help

What am I doing wrong?

./target/debug/mycmd --help
Usage: ./target/debug/mycmd [<test_file...>] -a <address> [-p <port>]

MyCMD

Options:
  -a, --address     address
  -p, --port        port
  --help            display usage information
#[derive(FromArgs)]
/// MyCMD
struct Opt {
    #[argh(option, short = 'a')]
    /// address
    address: String,
    #[argh(option, short = 'p')]
    /// port
    port: Option<u32>,
    #[argh(positional)]
    /// script files to run
    test_file: Vec<PathBuf>,
}

Geobert avatar Feb 19 '20 13:02 Geobert

You aren't doing anything wrong, that's currently how it currently works!

If you cd into that directory and run it as /mycmd --help it should display Usage: ./mycmd ...

It's not baked into the binary at compile time, it's the first argument grabbed from the environment.

benbrittain avatar Feb 19 '20 14:02 benbrittain

Thank you for your answer!

I see!

I think there's an issue on Windows because even in the folder, I get the absolute path :-/

It works on Linux though!

Geobert avatar Feb 19 '20 14:02 Geobert

Yeah, on Windows I also get an absolute path :/

Boscop avatar Jun 07 '20 02:06 Boscop

I believe this was closed by #44 , at least i can't reproduce this anymore.

cristicbz avatar May 25 '21 21:05 cristicbz

We still need a release to be able to use it through crates.io :)

Geobert avatar May 25 '21 21:05 Geobert