Skip to content

feat: vcs, color, and message format native completion #15322

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

Conversation

nooma-42
Copy link
Contributor

@nooma-42 nooma-42 commented Mar 18, 2025

What does this PR try to resolve?

Related to #14520

This PR introduces auto-completion for following options:

  1. --color option with values: auto, always, never
  2. --vcs option with values: git, hg, pijul, fossil, none
  3. --message-format option with values: human, short, json, json-diagnostic-short, json-diagnostic-rendered

Take --color as an example, when a user types cargo build --color <TAB>the system will automatically suggest auto, always, never

How should we test and review this PR?

To verify this feature, follow these steps:

  1. In the terminal, type cargo build --color <TAB> or cargo new my_project --vcs <TAB> or cargo check --message-format <TAB>
  2. Press the TAB key.
  3. You should see option suggestions
2025-03-18.4.29.14.mov

@rustbot
Copy link
Collaborator

rustbot commented Mar 18, 2025

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. Command-locate-project S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 18, 2025
@nooma-42 nooma-42 force-pushed the vcs,-color,-and-message-format-native-completion branch from d929d47 to 1407700 Compare March 18, 2025 16:41
@nooma-42 nooma-42 force-pushed the vcs,-color,-and-message-format-native-completion branch 2 times, most recently from 5d30926 to 8c74e6e Compare March 19, 2025 08:47
@epage
Copy link
Contributor

epage commented Mar 19, 2025

Please keep commits atomic which includes test passing in each commit

@nooma-42 nooma-42 force-pushed the vcs,-color,-and-message-format-native-completion branch from 8c74e6e to 16c4741 Compare March 20, 2025 11:39
@nooma-42 nooma-42 force-pushed the vcs,-color,-and-message-format-native-completion branch from 16c4741 to 3ea0e6b Compare March 20, 2025 14:16
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.

It is unfortunate that --message-format in cargo build has too many possible values and couldn't fit in one line.

Anyway this PR on its own is good to merge. Thank you!

@weihanglo
Copy link
Member

We could do a check-up for other places that might leverage possible values and delimiters API from clap

@weihanglo weihanglo added this pull request to the merge queue Mar 20, 2025
Merged via the queue into rust-lang:master with commit 8364f7b Mar 20, 2025
21 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2025
Update cargo

14 commits in 6cf8267012570f63d6b86e85a2ae5627de52df9e..307cbfda3119f06600e43cd38283f4a746fe1f8b
2025-03-14 15:25:36 +0000 to 2025-03-20 20:00:39 +0000
- feat: Add custom completer for cargo &lt;TAB&gt; to complete aliases defined in config.toml (rust-lang/cargo#15319)
- fix(build-dir): Renamed workspace-manifest-path-hash to workspace-path-hash (rust-lang/cargo#15334)
- feat: vcs, color, and message format native completion (rust-lang/cargo#15322)
- Fix `[env]` `relative` description in reference (rust-lang/cargo#15332)
- chore: fix some typos (rust-lang/cargo#15329)
- Cleanup for rustc-link-arg-cdylib (rust-lang/cargo#15326)
- fix(toml): Report '&lt;target&gt;.edition' deprecation to users (rust-lang/cargo#15321)
- test(build-std): address overly-matched snapshot (rust-lang/cargo#15325)
- Added `build.build_dir` templating support (rust-lang/cargo#15236)
- docs: make it clearer that `rust_version` is enforced during compile (rust-lang/cargo#15303)
- feat: Add custom completer for cargo +&lt;TAB&gt; to complete toolchain name (rust-lang/cargo#15301)
- chore: fix some typos (rust-lang/cargo#15316)
- fix: deduplicate crate types in cargo rustc command (rust-lang/cargo#15314)
- docs: mention wrong URLs as a cause of git authentication errors (rust-lang/cargo#15304)

r? ghost
@rustbot rustbot added this to the 1.87.0 milestone Mar 22, 2025
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. Command-locate-project S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants