You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
```
0 commit comments