-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix zsh completions for add and locate-project #10810
Conversation
The zsh tab-completion script had missing line continuations which would cause `command not found:` errors when trying to complete the `cargo add` or `cargo locate-project` subcommands.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon. Please see the contribution instructions for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the inconvenience and thanks for the fix!
Cargo lacks testing for shell completion and we're also looking forward to either dynamic completion support from clap or test improvement.
@bors r+ |
📌 Commit f44e2b5 has been approved by |
☀️ Test successful - checks-actions |
@Diomendius |
Sure, why not? Should I open another PR against |
Open a PR against 1.63 is fine. Thanks! |
…ihanglo [BETA-1.63] Fix zsh completions for add and locate-project This is a backport of #10810 to the `rust-1.63.0` branch. `src/etc/_cargo` is unchanged between this branch and `master` and only Zsh cares about the contents of this file, so there should be no issues with merging this.
Update cargo 9 commits in dbff32b27893b899ae2397f3d56d1be111041d56..c0bbd42ce5e83fe2a93e817c3f9b955492d3130a 2022-06-24 19:25:13 +0000 to 2022-07-03 13:41:11 +0000 - fix typo (rust-lang/cargo#10818) - fix(add): Don't panic with `--offline` (rust-lang/cargo#10817) - chore: Set permissions for GitHub actions (rust-lang/cargo#10816) - Bump to 0.65.0, update changelog (rust-lang/cargo#10812) - Fix zsh completions for add and locate-project (rust-lang/cargo#10810) - Bump cargo-util version. (rust-lang/cargo#10804) - Update os_info (rust-lang/cargo#10802) - Fix deserialization of check-cfg in config.toml (rust-lang/cargo#10799) - fix: bash complete `install --path` with dirs (rust-lang/cargo#10798)
Currently, trying to tab-complete either the
cargo add
orcargo locate-project
subcommands results in output such as this:This is because some line continuations are missing from
src/etc/_cargo
. This PR adds these line continuations.This file gets packaged for Rust releases by https://github.com/rust-lang/rust/blob/acdcdfb61b7b472bfacbb8bb889bdf3204827f2e/src/bootstrap/dist.rs#L956 and Rustup ultimately places it in
~/.rustup/toolchains/*/share/zsh/site-functions/_cargo
.rustup completions zsh cargo
outputs a script which sources this filepath.The easier approach to testing this is probably to manually copy
_cargo
to its proper location under~/.rustup
, assuming Rust is already installed via Rustup and Zsh completions for Cargo are already installed, but however you choose to install this, testing is as simple as observing that Zsh can correctly tab completecargo add
andcargo locate-project
.