-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add native completions for --package on various commands
#16210
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
Add native completions for --package on various commands
#16210
Conversation
|
r? @weihanglo rustbot has assigned @weihanglo. Use |
I much prefer the second. |
c3f74fd to
355f966
Compare
|
Feel free to clean up your commits to represent how they should be merged, rather than based on review feedback. We have guidance on atomic commits at https://doc.crates.io/contrib/process/working-on-cargo.html#submitting-a-pull-request |
|
Just some small stylstic changes and this should be good to go, thanks! |
c2aebcd to
fcaf35d
Compare
fcaf35d to
0819035
Compare
Yes, that was my intention with the force push after the first round of review feedback. But yea, the c2aebcd could be part of the first commit as well. |
Update cargo submodule 22 commits in 6368002885a04cbeae39a82cf5118f941559a40a..445fe4a68f469bf936b2fd81de2c503b233a7f4f 2025-10-31 14:31:52 +0000 to 2025-11-07 18:08:19 +0000 - fix(depinfo): prevent invalid trailing backslash on Windows (rust-lang/cargo#16223) - refactor: Remove lazycell (rust-lang/cargo#16224) - refactor: extract ConfigValue to its own module (rust-lang/cargo#16222) - fix(config): non-mergeable list from cli should take priority (rust-lang/cargo#16220) - fix(compile): build.warnings=deny shouldn't block hard warnings (rust-lang/cargo#16213) - fix: display absolute path in the `missing in PATH` warning (rust-lang/cargo#16125) - fix: non-mergeable list from config cli merge the same way (rust-lang/cargo#16219) - docs(contrib): Link out to rustc diagnostic style guide (rust-lang/cargo#16216) - fix: Remove build-plan (rust-lang/cargo#16212) - Add native completions for `--package` on various commands (rust-lang/cargo#16210) - fix(completions): don't wrap completion item help in parenthesis (rust-lang/cargo#16215) - refactor(locking): Make disabling locking on NFS mounts explicit (rust-lang/cargo#16177) - docs(unstable): Move compile-time-deps out of Stabilized section (rust-lang/cargo#16211) - docs(ref): Rename DEP_NAME_KEY to DEP_LINKS_KEY (rust-lang/cargo#16205) - feat(build-analysis): emit rebuild reason log entry (rust-lang/cargo#16203) - chore: Update dependencies (rust-lang/cargo#16200) - chore(deps): update cargo-semver-checks to v0.45.0 (rust-lang/cargo#16190) - chore(deps): update msrv (rust-lang/cargo#16178) - refactor: embed deserialize validation logic in ProgressConfig (rust-lang/cargo#16194) - refactor(gctx): extract config schema to a module (rust-lang/cargo#16195) - chore: bump to 0.94.0; update changelog (rust-lang/cargo#16191) - chore(deps): update rust crate gix to 0.74.0 (rust-lang/cargo#16186) r? ghost
Update cargo submodule 22 commits in 6368002885a04cbeae39a82cf5118f941559a40a..445fe4a68f469bf936b2fd81de2c503b233a7f4f 2025-10-31 14:31:52 +0000 to 2025-11-07 18:08:19 +0000 - fix(depinfo): prevent invalid trailing backslash on Windows (rust-lang/cargo#16223) - refactor: Remove lazycell (rust-lang/cargo#16224) - refactor: extract ConfigValue to its own module (rust-lang/cargo#16222) - fix(config): non-mergeable list from cli should take priority (rust-lang/cargo#16220) - fix(compile): build.warnings=deny shouldn't block hard warnings (rust-lang/cargo#16213) - fix: display absolute path in the `missing in PATH` warning (rust-lang/cargo#16125) - fix: non-mergeable list from config cli merge the same way (rust-lang/cargo#16219) - docs(contrib): Link out to rustc diagnostic style guide (rust-lang/cargo#16216) - fix: Remove build-plan (rust-lang/cargo#16212) - Add native completions for `--package` on various commands (rust-lang/cargo#16210) - fix(completions): don't wrap completion item help in parenthesis (rust-lang/cargo#16215) - refactor(locking): Make disabling locking on NFS mounts explicit (rust-lang/cargo#16177) - docs(unstable): Move compile-time-deps out of Stabilized section (rust-lang/cargo#16211) - docs(ref): Rename DEP_NAME_KEY to DEP_LINKS_KEY (rust-lang/cargo#16205) - feat(build-analysis): emit rebuild reason log entry (rust-lang/cargo#16203) - chore: Update dependencies (rust-lang/cargo#16200) - chore(deps): update cargo-semver-checks to v0.45.0 (rust-lang/cargo#16190) - chore(deps): update msrv (rust-lang/cargo#16178) - refactor: embed deserialize validation logic in ProgressConfig (rust-lang/cargo#16194) - refactor(gctx): extract config schema to a module (rust-lang/cargo#16195) - chore: bump to 0.94.0; update changelog (rust-lang/cargo#16191) - chore(deps): update rust crate gix to 0.74.0 (rust-lang/cargo#16186) r? ghost
What does this PR try to resolve?
Add dynamic completions for the various
-p <package>arguments.Fixes #15004
Supersedes #14553 and #15338
EDIT: the second implementation has been chosen
In the first commit I implemented the different completions for different usages by splitting the
arg_packagemethods into multiple ones if necessary:In the second commit I tried to instead pass an
ArgValueCandidatesinto the function to prevent that duplication.I think I have a small preference towards the latter, but no strong opinion.