-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
chore: Upgrade to clap 3.2 #10753
chore: Upgrade to clap 3.2 #10753
Conversation
r? @ehuss (rust-highfive has picked a reviewer for you, use r? to override) |
It looks like this might still be needed for the CI to pass. #10755 and #10754 both fail on i686-unknown-linux-gnu on the below test.
|
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.
Looks good!
I switched from a "look before you leap" approach with is_arg_valid to a "better to ask forgiveness than permission" with checking the error variant.
Sorry, I don't get it. How does this help?
Instead of We need to do something because any given cargo command may look up values for an arg that isn't defined because of how the code sharing works. Having a lot of |
Make sense. Thanks for the explanation. Going to merge this. @bors r+ |
📌 Commit fc0ca1e has been approved by |
☀️ Test successful - checks-actions |
4 commits in 4d92f07f34ba7fb7d7f207564942508f46c225d3..8d42b0e8794ce3787c9f7d6d88b02ae80ebe8d19 2022-06-10 01:11:04 +0000 to 2022-06-17 16:46:26 +0000 - Use specific terminology for sparse HTTP-based registry (rust-lang/cargo#10764) - chore: Upgrade to clap 3.2 (rust-lang/cargo#10753) - Improve testing framework for http registries (rust-lang/cargo#10738) - doc: Improve example of using the links field (rust-lang/cargo#10728)
Update cargo 4 commits in 4d92f07f34ba7fb7d7f207564942508f46c225d3..8d42b0e8794ce3787c9f7d6d88b02ae80ebe8d19 2022-06-10 01:11:04 +0000 to 2022-06-17 16:46:26 +0000 - Use specific terminology for sparse HTTP-based registry (rust-lang/cargo#10764) - chore: Upgrade to clap 3.2 (rust-lang/cargo#10753) - Improve testing framework for http registries (rust-lang/cargo#10738) - doc: Improve example of using the links field (rust-lang/cargo#10728)
Update cargo 4 commits in 4d92f07f34ba7fb7d7f207564942508f46c225d3..8d42b0e8794ce3787c9f7d6d88b02ae80ebe8d19 2022-06-10 01:11:04 +0000 to 2022-06-17 16:46:26 +0000 - Use specific terminology for sparse HTTP-based registry (rust-lang/cargo#10764) - chore: Upgrade to clap 3.2 (rust-lang/cargo#10753) - Improve testing framework for http registries (rust-lang/cargo#10738) - doc: Improve example of using the links field (rust-lang/cargo#10728)
Update cargo 4 commits in 4d92f07f34ba7fb7d7f207564942508f46c225d3..8d42b0e8794ce3787c9f7d6d88b02ae80ebe8d19 2022-06-10 01:11:04 +0000 to 2022-06-17 16:46:26 +0000 - Use specific terminology for sparse HTTP-based registry (rust-lang/cargo#10764) - chore: Upgrade to clap 3.2 (rust-lang/cargo#10753) - Improve testing framework for http registries (rust-lang/cargo#10738) - doc: Improve example of using the links field (rust-lang/cargo#10728)
This is due to a change in clap 3.2. Cargo's CI runs without a lock file, but rust-lang/rust runs with one (locked to an older version). To avoid issues, this just ignores the test. See rust-lang#10753 for more.
I decided to use cargo as a test case for upgrading to clap 3.2 prior to release. From the builder API's perspective, a lot has change. While the changelog summarizes it, the release announcement is still pending. In short, the API is now typed. You declare what type an
Arg
is and access it by that type. flags (bothis_present
andoccurrences_of
) are also now specified throughArgAction
and the result gets stored like any other arg value. I made aArgMatchesExt::flag
andcommand_prelude::flag
functions to make working with these easier.Now that clap exposes non-panicking variants of its functions, I switched from a "look before you leap" approach with
is_arg_valid
to a "better to ask forgiveness than permission" with checking the error variant. I decided to just make a convenience to swallow that error type. Not a fan of how loose things are but I think this will just be something we iterate on over time.