Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak build help to clarify role of --bin #12157

Merged
merged 2 commits into from
May 20, 2023
Merged

Conversation

kornelski
Copy link
Contributor

@kornelski kornelski commented May 18, 2023

From user feedback 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, 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:

      --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:

      --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

@rustbot
Copy link
Collaborator

rustbot commented May 18, 2023

r? @weihanglo

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 18, 2023
@weihanglo
Copy link
Member

This is another data point that #11912 might be useful.

I'll take a deeper look of it tomorrow.

Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty reasonable enhancement. Thank you!

I'd like to know what people's thoughts on this, especially @epage who's the maintainer of clap.

Copy link
Contributor

@epage epage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a reasonable change to me

@weihanglo
Copy link
Member

Will merge this and move on. We can always reverse the change easily.

@bors r+

@bors
Copy link
Collaborator

bors commented May 20, 2023

📌 Commit 75a1dd0 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 20, 2023
@bors
Copy link
Collaborator

bors commented May 20, 2023

⌛ Testing commit 75a1dd0 with merge a6c0d43...

@bors
Copy link
Collaborator

bors commented May 20, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing a6c0d43 to master...

@bors bors merged commit a6c0d43 into rust-lang:master May 20, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request May 23, 2023
Update cargo

10 commits in 09276c703a473ab33daaeb94917232e80eefd628..64fb38c97ac4d3a327fc9032c862dd28c8833b17
2023-05-16 21:43:35 +0000 to 2023-05-23 18:53:23 +0000
- Consider rust-version when selecting packages for cargo add (rust-lang/cargo#12078)
- fix(lints): Switch to -Zlints so stable projects can experiment (rust-lang/cargo#12168)
- Automatically inherit workspace fields when running cargo new/init (rust-lang/cargo#12069)
- ci: check if any version bump needed for member crates (rust-lang/cargo#12126)
- feat: `lints` feature (rust-lang/cargo#12148)
- fix: pass `-C debuginfo` after weakening if explicitly set (rust-lang/cargo#12165)
- Tweak build help to clarify role of --bin (rust-lang/cargo#12157)
- fix: Pass CI on nightly (rust-lang/cargo#12160)
- docs(source): doc comments for Source and its impls (rust-lang/cargo#12159)
- docs(source): doc comments for `Source` and friends (rust-lang/cargo#12153)

r? `@ghost`
saethlin pushed a commit to saethlin/miri that referenced this pull request May 26, 2023
Update cargo

10 commits in 09276c703a473ab33daaeb94917232e80eefd628..64fb38c97ac4d3a327fc9032c862dd28c8833b17
2023-05-16 21:43:35 +0000 to 2023-05-23 18:53:23 +0000
- Consider rust-version when selecting packages for cargo add (rust-lang/cargo#12078)
- fix(lints): Switch to -Zlints so stable projects can experiment (rust-lang/cargo#12168)
- Automatically inherit workspace fields when running cargo new/init (rust-lang/cargo#12069)
- ci: check if any version bump needed for member crates (rust-lang/cargo#12126)
- feat: `lints` feature (rust-lang/cargo#12148)
- fix: pass `-C debuginfo` after weakening if explicitly set (rust-lang/cargo#12165)
- Tweak build help to clarify role of --bin (rust-lang/cargo#12157)
- fix: Pass CI on nightly (rust-lang/cargo#12160)
- docs(source): doc comments for Source and its impls (rust-lang/cargo#12159)
- docs(source): doc comments for `Source` and friends (rust-lang/cargo#12153)

r? `@ghost`
@ehuss ehuss added this to the 1.71.0 milestone May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Area: Command-line interface, option parsing, etc. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants