-
Notifications
You must be signed in to change notification settings - Fork 893
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
refactor(cli): rewrite rustup
with clap_derive
#3596
Conversation
c146305
to
baf8b69
Compare
clap_derive
rustup-init
with clap_derive
26ca09e
to
39e49e0
Compare
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 |
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
55a1861
Compare
55a1861
to
0d85d0f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
1d30214
to
5dcbd32
Compare
rustup-init
with clap_derive
rustup
and rustup-init
with clap_derive
63b7b41
to
30e959c
Compare
@djc How you would like to see my I guess porting However, porting |
5d389e7
to
8a22d57
Compare
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 |
f8e9756
to
8fe3c00
Compare
f175f18
to
986b302
Compare
Closes #3549.
Rationale
Currently, to add a new subcommand/argument to
rustup
orrustup-init
, one will have to manually maintain consistencies across 3 places (Command
,ArgMatches
and 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
);Parser
and dispatching), and this time one will be covered by strongly-typed APIs.Initially, I decided to experiment with
rustup-init
since it's relatively isolated, and I was surprised to find out that even with such a simple command, migrating toclap_derive
already 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-init
withclap_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