Uh oh!
There was an error while loading. Please reload this page.
refactor(cli): rewrite rustup with clap_derive - #3596
Conversation
c146305 to
baf8b69Compareclap_deriverustup-init with clap_derive26ca09e to
39e49e0Comparedjc
commented
Dec 21, 2023
Thanks for working on this!
Why do you want to keep this out of 1.27.0? It maybe doesn't need to go in, but I don't see any harm from it being merged? (Is that the only reason this is in Draft state, or are there other reasons?) |
@djc Oh, it's the only reason actually. IMO the overall migration is a huge amount of work that consists of multiple patches and I think it's quite weird to ship a new version half-migrated. I plan to do this on a per-subcommand basis when it comes to |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
djc
commented
Dec 22, 2023
I can see how it might be weird to ship half-migrated so I guess I agree maybe we shouldn't merge this yet until we have the other CLIs migrated. |
39e49e0 to
55a1861Compare55a1861 to
0d85d0fCompareUh oh!
There was an error while loading. Please reload this page.
This comment was marked as outdated.
This comment was marked as outdated.
1d30214 to
5dcbd32Comparerustup-init with clap_deriverustup and rustup-init with clap_derive63b7b41 to
30e959cCompare@djc How you would like to see my I guess porting However, porting |
5d389e7 to
8a22d57Comparedjc
commented
Jan 22, 2024
As long as there is not a lot of back and forth, I think your current commit history of doing one subcommand at a time looks pretty good actually -- I think this will make it fairly straightforward to review. Looks like you're making good progress! |
@djc Just found out that our clap builder broke I feel a bit guilty right now about using auto-formatting on save to cause weird diffs... PS: Also, to my surprise, will all the scaffolds removed in the end, the whole |
This aligns with <rust-lang#3596>.
This aligns with <#3596>.
Closes#3549.
Rationale
Currently, to add a new subcommand/argument to
rustuporrustup-init, one will have to manually maintain consistencies across 3 places (Command,ArgMatchesand dispatching). Failing to do so will unavoidably lead to panics.Hopefully, with
clap_derive, it'll be much easier to dive in the codebase and make changes, as:run()forrustup run);Parserand dispatching), and this time one will be covered by strongly-typed APIs.Initially, I decided to experiment with
rustup-initsince it's relatively isolated, and I was surprised to find out that even with such a simple command, migrating toclap_derivealready allows us to address some inconsistencies.Given that successful experience, I think a complete migration will be not only feasible but fruitful, which can hopefully reduce accidental complexities in maintaining this project.
PS: Please don't merge this before closing #3501.Progress
rustup-init(became refactor(cli): rewriterustup-initwithclap_derive#3814)Footnotes
This command is hidden. ↩↩2↩3
This command is implemented as an alias of the corresponding subcommand under
rustup toolchain. ↩↩2This command has subcommands. ↩↩2↩3↩4↩5↩6↩7