-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Generate shell completions for bootstrap with Clap #111388
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Can we support powershell here too? I saw you're only completing subcommands - now that this is part of bootstrap proper, can we support paths as well? also, I think rather than an env variable we should commit this somewhere in |
Paths, as well as the |
Sorry, "paths" is the wrong word - I meant using the |
Ah, I see - we could potentially do some post-processing on the output but that seems like it could be a bit brittle. It might be possible to tweaks the |
👍 if it it's tricky i'm also happy to land this as it, it already seems like a big improvement :) |
Added a new |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
src/bootstrap/run.rs
Outdated
if let Some(comp) = get_completion(shells::PowerShell, &powershell) { | ||
std::fs::write(&powershell, comp).expect("writing powershell completion"); | ||
} | ||
// FIXME: zsh generated completions don't seem to work well with subcommands |
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.
Can we report this upstream to clap_complete
?
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.
I'll look at properly diagnosing and reporting the issue today
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.
clap-rs/clap#4898, clap-rs/clap#4899 might fix this
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.
Even after fixing this error, flags don't seem to be being suggested after the subcommand and the path completion isn't working at all 🤔
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.
Merged now, I'll investigate the remaining issues with Zsh soon. I'll open a follow-up bumping the clap_complete version when I have a fix
This comment has been minimized.
This comment has been minimized.
e73ea97
to
4a3e651
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.
this is awesome, thank you!
9f5ebec
to
307f057
Compare
@bors r+ This already seems like a big improvement, we can iterate in follow-up PRs :) Could you also make a PR documenting in this in the dev-guide, maybe around https://rustc-dev-guide.rust-lang.org/building/suggested.html ? |
📌 Commit 307f0576129a463533a65ec3f8fa35b9da53b62f has been approved by It is now in the queue for this repository. |
🌲 The tree is currently closed for pull requests below priority 50. This pull request will be tested once the tree is reopened. |
I've just updated the filenames to |
@bors r- r+ |
🌲 The tree is currently closed for pull requests below priority 50. This pull request will be tested once the tree is reopened. |
⌛ Testing commit a348f8a with merge db5d56a3714ee1602c47c6303186fadc5b23b268... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (2e18605): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 660.195s -> 659.769s (-0.06%) |
Now that #110693 has been merged, we can look at generating shell completions for x.py with
clap_complete
. Leaving this as draft for now as I'm not sure of the best way to integration the completion generator. Additionally, the generated completions for zsh are completely broken (will need to be resolved upstream, it doesn't seem to handle subcommands + global arguments well).I don't have Fish installed and would be interested to know how well completions work there.
Alternative to #107827