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
Add native completions for --package on various commands (#16210)
### What does this PR try to resolve?
Add dynamic completions for the various `-p <package>` arguments.
Fixes#15004
```
cargo bench|build|check|doc|fix|test -p <tab>`
cargo package|publish -p <tab>
cargo add|pkgid|remove|report|run|rustc|rustdoc -p <tab>
cargo uninstall -p <tab>
cargo tree -p <tab> -i <tab>
cargo clean -p <tab> # not implemented
```
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_package` methods into multiple
ones if necessary:
```
* arg_package_spec
* arg_package_spec_no_all
* arg_installed_package_spec_no_all <- new (for cargo uninstall)
* arg_dependency_package_spec_no_all <- new (for cargo tree)
* arg_clean_package_spec_simple <- new (for cargo clean)
* arg_package_spec_simple
* arg_package
```
In the second commit I tried to instead pass an `ArgValueCandidates`
into the function to prevent that duplication.
```
* arg_package_spec
* arg_package_spec_no_all (ArgValueCandidates)
* arg_package_spec_simple (ArgValueCandidates)
* arg_package
```
I think I have a small preference towards the latter, but no strong opinion.
0 commit comments