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

Fix zsh completions for add and locate-project #10810

Merged
merged 1 commit into from
Jul 1, 2022
Merged

Fix zsh completions for add and locate-project #10810

merged 1 commit into from
Jul 1, 2022

Conversation

Diomendius
Copy link
Contributor

Currently, trying to tab-complete either the cargo add or cargo locate-project subcommands results in output such as this:

cargo add _cargo:67: command not found: --default-features[enable the default features]
_cargo:68: command not found: --no-default-features[don't enable the default features]
_cargo:69: command not found: --optional[mark the dependency as optional]

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 complete cargo add and cargo locate-project.

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.
@rust-highfive
Copy link

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 1, 2022
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.

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.

@weihanglo
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 1, 2022

📌 Commit f44e2b5 has been approved by weihanglo

@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 Jul 1, 2022
@bors
Copy link
Collaborator

bors commented Jul 1, 2022

⌛ Testing commit f44e2b5 with merge cf26c4a...

@bors
Copy link
Collaborator

bors commented Jul 1, 2022

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

@bors bors merged commit cf26c4a into rust-lang:master Jul 1, 2022
@weihanglo
Copy link
Member

@Diomendius
Could you backport this against branch rust-1.63.0? I guess it's good to have it in beta channel.

@Diomendius
Copy link
Contributor Author

Sure, why not? Should I open another PR against rust-1.63.0 or would another method be more appropriate?

@weihanglo
Copy link
Member

Open a PR against 1.63 is fine. Thanks!

bors added a commit that referenced this pull request Jul 1, 2022
…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.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 5, 2022
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)
@ehuss ehuss added this to the 1.64.0 milestone Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants