-
Notifications
You must be signed in to change notification settings - Fork 13.3k
bootstrap: show available paths help text for aliased subcommands #95875
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
Conversation
Running `./x.py build -h -v` shows a list of available build targets, but the short alias `./x.py b -h -v` does not. Fix so that the aliases behave the same as their spelled out counterparts.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (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.
This looks good to me, but I think we should consider consolidating these to be consistent at some point - there's a ton of these matches sprawled across src/bootstrap.
@bors r+ rollup Yeah, consolidating this into one place may be a little difficult but likely worthwhile. |
📌 Commit e4bbbac has been approved by |
Yeah, I was a bit surprised at the number of string based matches for subcommand rather than parsing into an enum early on. The Here's a general idea for one way this could be refactored enum SubcommandKind {
Build,
Check,
...
}
impl FromStr for SubcommandKind {...}
impl SubcommandKind {
fn add_extra_opts(&self, opts: &mut Options) { /* flags.rs lines 279-338 */}
fn add_extra_help(&self, subcommand_help: &mut String) { /* flags.rs lines 397-539 */ }
fn build_subcommand(&self, paths: Vec<PathBuf>, matches: &Matches) -> Result<Subcommand> {
/* flags.rs lines 550-624 */
}
} Pros of this: matching on an enum rather than string names of the commands, splitting up the very long |
…imulacrum bootstrap: show available paths help text for aliased subcommands Running `./x.py build -h -v` shows a list of available build targets, but the short alias `./x.py b -h -v` does not. Fix so that the aliases behave the same as their spelled out counterparts.
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#95743 (Update binary_search example to instead redirect to partition_point) - rust-lang#95771 (Update linker-plugin-lto.md to 1.60) - rust-lang#95861 (Note that CI tests Windows 10) - rust-lang#95875 (bootstrap: show available paths help text for aliased subcommands) - rust-lang#95876 (Add a note for unsatisfied `~const Drop` bounds) - rust-lang#95907 (address fixme for diagnostic variable name) - rust-lang#95917 (thin_box test: import from std, not alloc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
I think just adding the new variants will be simpler than trying to introduce a new type. Are you interested in working on that? I'm happy to mentor :) |
Running
./x.py build -h -v
shows a list of available build targets,but the short alias
./x.py b -h -v
does not. Fix so that the aliasesbehave the same as their spelled out counterparts.