bootstrap: show available paths help text for aliased subcommands#95875
bootstrap: show available paths help text for aliased subcommands#95875bors merged 1 commit intorust-lang:masterfrom
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. |
|
@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 -vshows a list of available build targets,but the short alias
./x.py b -h -vdoes not. Fix so that the aliasesbehave the same as their spelled out counterparts.