Commit a6c0d43
committed
Auto merge of #12157 - kornelski:binargs, r=weihanglo
Tweak build help to clarify role of --bin
From [user feedback](https://internals.rust-lang.org/t/pre-issue-feature-request-give-me-the-option-to-not-build-a-target/18852/5) the `--bin`'s description "Build only the specified binary" could be understood as "Don't build lib" rather than "Build this bin (with lib) and not other bins".
I don't know if a better wording explaining subtelty of lib+bin crates would fit in the small space of CLI help. However, reordering the args to show `--bin` after `--bins` rather than after `--lib` gives it a more accurate context. So I've merely put the `--bin` (and test/bench/example) after their plural counterpart.
I've also noticed an issue with clap [inserting global args between subcommand's args](clap-rs/clap#4920), and `--locked` definitely doesn't belong right between the two bin args. I've added a workaround for that issue. The workaround is otherwise harmless, and shouldn't cause problems if clap decides to update sort order of subcommands.
Changes this:
```text
--lib Build only this package's library
--bin [<NAME>] Build only the specified binary
--locked Require Cargo.lock is up to date
--bins Build all binaries
--offline Run without accessing the network
--config <KEY=VALUE> Override a configuration value
--example [<NAME>] Build only the specified example
--examples Build all examples
-Z <FLAG> Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
--test [<NAME>] Build only the specified test target
--tests Build all tests
--bench [<NAME>] Build only the specified bench target
--benches Build all benches
```
to this:
```text
--lib Build only this package's library
--bins Build all binaries
--bin [<NAME>] Build only the specified binary
--examples Build all examples
--example [<NAME>] Build only the specified example
--tests Build all tests
--test [<NAME>] Build only the specified test target
--benches Build all benches
--bench [<NAME>] Build only the specified bench target
[…]
--locked Require Cargo.lock is up to date
--offline Run without accessing the network
--config <KEY=VALUE> Override a configuration value
-Z <FLAG> Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
```2 files changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
443 | 446 | | |
444 | 447 | | |
445 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | 94 | | |
96 | | - | |
| 95 | + | |
97 | 96 | | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | 110 | | |
112 | | - | |
| 111 | + | |
113 | 112 | | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
0 commit comments