-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Describe the problem you are trying to solve
When I invoke cargo run --bin program --help
, sometimes I intended for the --help
to be passed to the program I am invoking, rather than cargo
itself.
Right now, the above invocation spits out the same information that you get when you do cargo run --help
.
The information emitted does include the command syntax: cargo run [OPTIONS] [--] [args]...
But it doesn't provide guidance specifically saying that I might have intended to feed in the --help
as part of the [args]...
Describe the solution you'd like
In an ideal world, cargo
would read my mind and figure out whether the --help
is intended for cargo
itself, or for the program I'm running, and only pass it to whichever I intended. Of course its not realistic, but it does spell out one ambitious option:
cargo run --help
could include both the--help
forcargo run
itself, and also run the binary passing--help
to it
The main problem with that option is that running the binary may have side-effects that one would never intend from invoking cargo run --help
. For that, I'd suggest running the binary in a sandbox: no file-writes, no network traffic.
Still, that approach may be a lot of work for an approach that still might be a minefield.
So here is a more conservative option:
cargo run --help
could explicitly point out how to adjust the command line to pass--help
to the underlying binary.
So, cargo run --help
would also include a line suggesting that one might do cargo run -- --help
Likewise, cargo run --bin program --help
would include a line suggesting cargo run --bin program -- --help
.