-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Is it possible to not show usage string in post validation errors? #3227
Comments
I assume you are specifically referring to errors reported by
I do not see any comments saying why some errors include usage and some do not. It might be interesting to try to infer this by looking at what errors include usage. |
Marked this as 3.0. I don't think we'd consider this breaking to change and doesn't seem the most critical, so we probably won't be blocking 3.0 on this but at least want to track 3.0 related items. |
With usage
Without usage
Overall, I'm not seeing a pattern
It looks like clap2 is similar, except for |
If I were to put myself in the user's shoes, I would find the Missing positional argument
Conflict between a positional argument and a flag
Positional argument type conversion error(I think it makes sense to print
Missing required flag/option
On the other hand, optional flags/options are often condensed in the usage string so I wouldn't find the
As for custom errors, they might or might not need a
But with Clap 3.x, I like how the previous error message is suddenly more helpful plus the suggestion to use
But in another case, I found the
|
We can fix that:
if I'm understanding this case, Part of me wonders if that is a bit specialized of a case, if Additionally, associating a name with it helps people know where in With that said, this depends on how clear it is that |
Sound good to me. I assume you meant the particular optional parameter that failed, correct?
That is actually a good idea. Here is what the same error would look like if it included the
Thanks for the tip! |
#3402 is exposing the inputs to error formatting so people can customize it as they wish without having to rely on options to control every piece of behavior. Think this would work for your case? |
Maintainer's notes:
--
Discussed in #3226
Originally posted by ducaale December 27, 2021
In Structopt/Clap 2.x, errors from both initial-parsing and post-processing errors didn't include the Usage string. However, in Clap 3.x, post-processing errors include the usage string. Is there a way to opt-out of this new behavior in Clap 3.x?
Structopt/Clap 2.x
Clap 3.x
The text was updated successfully, but these errors were encountered: