-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: Ease clap2->clap3 migration with deprecations #2718
Conversation
753ee04
to
b0ff215
Compare
@pksunkara any update on this? It passes CI, just re-pushed as part of rebase |
I am waiting on this because we have to finalize the discussion on #2617 |
533e480
to
3bdee37
Compare
Looks like we agreed in #2617 on this direction. Going ahead with a post-merge review. bors r+ |
I don't think we agreed on there, right? At least that's the impression I get. Can we please wait on this a bit more? There is no need for urgency |
bors r- |
Canceled. |
@kbknapp seemed in favor of this 10 days ago and I hadn't seen a post from you.
This has been open for 2 months. I have to deal with merge conflicts, designs are blocked on a decision, and mental state gets lost, like with #2721. We can't just let these things be left around. |
- `App::with_defaults` was not included since that has been deprecated since 2.14 - `App::args_from_usage` does not have a close enough parallel in the new API, as far as I could tell - `ArgMatches::usage` cannot have a thin wrapper around `App::generate_usage`. - `App::write_*`: getting lazy, didn't seem like high value functions - Any `Settings` (some things need to be figured out here) This is a part of clap-rs#2617
This gives users the basic error template for quick and dirty messages. In addition to the lack of customization, they are not given anything to help them with coloring or for programmayic use (info, source). This is something I've wanted many times for one-off validation that can't be expressed with clap's validation or it just wasn't worth the hoops. The more pressing need is for clap-rs#2255, I need `clap_derive` to be able to create error messages and `Error::with_description` seemed too disjoint from the rest of the clap experience that it seemed like users would immediately create issues about it showing up. With this available, I've gone ahead and deprecated `Error::with_description`, assuming this will be sufficient for users needs (or they can use IO Errors as a back door). I did so according to the pattern in clap-rs#2718 despite us not being fully resolved on that approach yet.
This gives users the basic error template for quick and dirty messages. In addition to the lack of customization, they are not given anything to help them with coloring or for programmayic use (info, source). This is something I've wanted many times for one-off validation that can't be expressed with clap's validation or it just wasn't worth the hoops. The more pressing need is for clap-rs#2255, I need `clap_derive` to be able to create error messages and `Error::with_description` seemed too disjoint from the rest of the clap experience that it seemed like users would immediately create issues about it showing up. With this available, I've gone ahead and deprecated `Error::with_description` (added in 58512f2), assuming this will be sufficient for users needs (or they can use IO Errors as a back door). I did so according to the pattern in clap-rs#2718 despite us not being fully resolved on that approach yet.
This gives users the basic error template for quick and dirty messages. In addition to the lack of customization, they are not given anything to help them with coloring or for programmayic use (info, source). This is something I've wanted many times for one-off validation that can't be expressed with clap's validation or it just wasn't worth the hoops. The more pressing need is for clap-rs#2255, I need `clap_derive` to be able to create error messages and `Error::with_description` seemed too disjoint from the rest of the clap experience that it seemed like users would immediately create issues about it showing up. With this available, I've gone ahead and deprecated `Error::with_description` (added in 58512f2), assuming this will be sufficient for users needs (or they can use IO Errors as a back door). I did so according to the pattern in clap-rs#2718 despite us not being fully resolved on that approach yet.
bors r+ |
This gives users the basic error template for quick and dirty messages. In addition to the lack of customization, they are not given anything to help them with coloring or for programmayic use (info, source). This is something I've wanted many times for one-off validation that can't be expressed with clap's validation or it just wasn't worth the hoops. The more pressing need is for clap-rs#2255, I need `clap_derive` to be able to create error messages and `Error::with_description` seemed too disjoint from the rest of the clap experience that it seemed like users would immediately create issues about it showing up. With this available, I've gone ahead and deprecated `Error::with_description` (added in 58512f2), assuming this will be sufficient for users needs (or they can use IO Errors as a back door). I did so according to the pattern in clap-rs#2718 despite us not being fully resolved on that approach yet.
Build succeeded: |
This gives users the basic error template for quick and dirty messages. In addition to the lack of customization, they are not given anything to help them with coloring or for programmayic use (info, source). This is something I've wanted many times for one-off validation that can't be expressed with clap's validation or it just wasn't worth the hoops. The more pressing need is for clap-rs#2255, I need `clap_derive` to be able to create error messages and `Error::with_description` seemed too disjoint from the rest of the clap experience that it seemed like users would immediately create issues about it showing up. With this available, I've gone ahead and deprecated `Error::with_description` (added in 58512f2), assuming this will be sufficient for users needs (or they can use IO Errors as a back door). I did so according to the pattern in clap-rs#2718 despite us not being fully resolved on that approach yet.
/// Deprecated, see [`Arg::forbid_empty_values`] | ||
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::forbid_empty_values`")] | ||
pub fn empty_values(self, empty: bool) -> Self { | ||
self.forbid_empty_values(!empty) |
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 is not correct btw, Check the old code in v2
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.
Please, when you see a problem, say what the problem is, rather than requiring the person to diff to very different code bases in hopes of seeing what the difference was.
From my reading of clap2, I have not seen what is incorrect about it. I'm glad you identified a problem but please help out and say what it is.
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.
I sometimes forget that you don't have the context for what we changed.
Here's the old code which was actually leading to bugs, https://docs.rs/clap/2.33.3/src/clap/args/arg.rs.html#2297-2304.
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.
Let me double check, you are trying to call out that this is missing the "forbidding empty values implies taking a value" part?
If so, I'll get that noted on #2617 to be looked at as part of the wider inference look.
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.
Yes.
I'll get that noted on #2617 to be looked at as part of the wider inference look.
What do you mean by that? In case you mean that we want to add inference back into the settings, then I disagree because that caused a lot of bugs.
This was done based on the README. I've not done a deep dive of the docs to see what might have been missed.
App::with_defaults
was not included since that has been deprecatedsince 2.14
App::args_from_usage
does not have a close enough parallel in thenew API, as far as I could tell
ArgMatches::usage
cannot have a thin wrapper aroundApp::generate_usage
.App::write_*
: getting lazy, didn't seem like high value functionsSettings
(some things need to be figured out here)This is a part of #2617