Commit 555f91a
committed
fix(run): Help teach about argument escaping
It is not obvious that how to escape arguments to be forwarded literally to an underlying program,
like `--help`.
`cargo test` has a message:
```
Run `cargo test -- --help` for test binary options.
```
Mirroring that exactly in `cargo run` isn't appropriate because we'd be
saying there is `--help` when there might not be.
Instead, I took inspiration from clap's error message:
```console
$ cargo test --gfdfgdf
error: unexpected argument '--gfdfgdf' found
tip: to pass '--gfdfgdf' as a value, use '-- --gfdfgdf'
Usage: cargo test [OPTIONS] [TESTNAME] [-- [ARGS]...]
For more information, try '--help'.
```
I checked `cargo rustc` and `cargo rustdoc` to see if they could be
helped like this but they will return errors about needing to specify
the specific binary, so they are a little more complicated.
Fixes #97071 parent 445fe4a commit 555f91a
File tree
2 files changed
+7
-4
lines changed- src/bin/cargo/commands
- tests/testsuite/cargo_run/help
2 files changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
Loading
0 commit comments