-
Notifications
You must be signed in to change notification settings - Fork 891
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
Shell completions for Cargo #1646
Conversation
Hi @yodaldevoid Thanks for your contribution. Could you possibly tidy up the commit sequence (e.g. fold the fixes to formatting into the requisite commits instead of having a 'run rustfmt' commit) to make it easier to review? I've put this PR on my list to watch but I'd like to see things a little tidier before I review. I look forward to your changes. D |
e843bf1
to
49626f9
Compare
Hello @kinnison Thanks for getting to looking over this. I've tidied up the rustfmt commit, but no other commits jumped out at me as being appropriate to tidy up. Is there anything else you would like cleaned up? I should note that I wanted to keep @ricvelozo's commits mostly intact. They could get merged together with other commits, to condense everything, but I wanted to preserve his contribution. |
Fair enough, I can appreciate wanting to maintain that. I'll put this on my list to review as soon as I can (likely within a day or two) |
☔ The latest upstream changes (presumably #1630) made this pull request unmergeable. Please resolve the merge conflicts. |
49626f9
to
da9db14
Compare
@kinnison Just wanted to ping you to make sure this hasn't fallen by the wayside. |
da9db14
to
e80e3a5
Compare
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.
First up, thank you for submitting a PR and contributing to rustup
.
This is not a bad PR, though there are a number of points which need cleanup. The big thing is that there's a distinct lack of tests.
Could we please have some basic tests for the new command you're adding?
Thanks,
D.
FWIW, I'm proposing a new approach for completions for cargo at rust-lang/cargo#6645. It may not have any impact here, but just wanted to make you aware. |
@ehuss I'll keep an eye on that discussion, and when/if it gets implemented if no one else does it I'll make sure to submit a PR moving to the new system for newer versions of |
Thanks, @ehuss, I've been meaning to cross link that here. |
☔ The latest upstream changes (presumably #1704) made this pull request unmergeable. Please resolve the merge conflicts. |
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
This "command" argument allows rustup to output the completion information of more than just rustup. In this case it adds a cargo completion script. Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
This allows the cargo script for the current default toolchain to be called, and if the script is ever updated the user won't have to maually update their completion script after updating Rust. Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
e80e3a5
to
eeb1d4c
Compare
This removes the duplication between the `variants` and `from_str` implementations.
eeb1d4c
to
02d63fc
Compare
@kinnison Sorry about the long time since the last update. As the famous quote goes, "Life... finds a way to always get in the way of projects." I believe I have addressed all requested changes. Please let me know if there is anything else you would like modified. |
Moves the error reporting from the completion function to the standard error handling mechanism. CompletionCommand had to be made fully public, not that this matters for a binary target. That said, this could have been prevented by transforming the CompletionCommand into its String form at the error site rather than at the reporting site. It was chosen to go with this method as stringly-typed interfaces are generally bad.
Compares two different command invocations and panics if their return code and stdout/stderr don't match.
eed1d01
to
0312b11
Compare
Thank you for making the updates, I'll endeavour to review this, likely tomorrow. |
@kinnison I hate to be a hypocrite in this regard, but I wanted to ping you about this PR as it has been some time. |
No, that's very fair, I needed a kick up the backside it seems the past two weeks have been busy and somehow this slipped off my TODO without me noticing :( |
This looks reasonable to me, I'm grateful for the tests too. I wonder if the user ought to be told about how the completions script they're given may vary with the default toolchain; but ultimately I think that's not worth blocking this for. |
References: rust-lang/rustup#1646 Signed-off-by: Fletcher Nichol <fnichol@nichol.ca>
Are there fish completions yet? |
If you want to contribute, please help with rust-lang/cargo#6645 . |
This is a cleanup of a prior PR (#1425) by @ricvelozo.
rustup completions <shell> cargo