-
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
Target tab completion invokes rustup
#12585
Comments
Another idea is we can go with |
Is there a reason to prefer rustup? I guess so you can check which targets are actually installed? |
Yes. Completing with installed ones. |
Yeah, making both do |
By the way, in Fedora, the programmer does not have access to packaged |
I can probably whip this up by tomorrow, already have the bash one ready, just need to do some testing with the ZSH one. |
@rustbot claim |
fix(cli): Help users know possible `--target` values ### What does this PR try to resolve? I was needing to do some more cross-compilation and forgot what the target triple was that I needed to run. I realized i had to re-remember the command yet again. Especially with #12585 in memory, I realized that `--target` isn't working like `--package` and other arguments that can report supported values. In working on it, I realized I probably didn't want to report supported values yet out of concern for how big the list is (see also #12585), so I decided to just list the relevant commands for now. We *might* be able to parse the rustup output to report those targets but I didn't receive a glowing endorsement from the rustup team about parsing the list (more of "yes, hyrums law and at least its interactive rather than CI"). Before: ``` error: a value is required for '--target <TRIPLE>' but none was supplied For more information, try '--help'. ``` After: ``` error: "--target" takes a target architecture as an argument. Run `rustup target list` to see possible targets. ``` (quotes were used because the other "list available" use them, we should probably work to be uniform in how we quote) ### How should we test and review this PR? First PR adds a test showing the existing output and then through the rest you can see how the output changed
Problem
Invoking
cargo build --target <TAB>
invokesrustup
. Some environments may not have it installed and I do not see why it should be invoked if the tab completion can run equivalent ofrustc --print target-list
.Steps
cargo build --target
on terminal and then press the TAB key.rustup
is not installed, terminal will print:cargo build --target bash: rustup: command not found
Possible Solution(s)
I suppose
cargo
could return the output ofrustc --print target-list
Notes
It is generally a good idea to depend only on the most basic tools, especially if they get the job done right, like
rustc
does.Version
The text was updated successfully, but these errors were encountered: