-
Notifications
You must be signed in to change notification settings - Fork 87
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
Allow to disable requirement for uncapitalized descriptions #155
base: master
Are you sure you want to change the base?
Conversation
This strict requirement makes sense only for programs designed for Fuchsia, no other system has this convention. This commit adds a type-level attribute `lax_description` that disables the option descriptions validation when present.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
@@ -6,7 +6,12 @@ use {argh::FromArgs, std::fmt::Debug}; | |||
|
|||
#[derive(FromArgs, PartialEq, Debug)] | |||
/// Top-level command. | |||
#[argh(lax_descriptions)] |
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.
Seems like a weird place to add this to the example.
/// Test that descriptions can start with any case when | ||
/// the type attribute `lax_descriptions` is specified. | ||
#[derive(FromArgs)] | ||
#[argh(lax_descriptions)] |
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.
Not sure I like the name "lax_descriptions". Seems a bit generic.
check_option_description(errors, d.content.value().trim(), d.content.span()); | ||
if !type_attrs.lax_descriptions { | ||
if let Some(d) = &this.description { | ||
check_option_description(errors, d.content.value().trim(), d.content.span()); |
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 think we should change the behavior of check_option_description rather than skipping it entirely when the option is set.
This strict requirement makes sense only for programs designed for Fuchsia, no other system has this convention.
This commit adds a type-level attribute
lax_description
that disables the option descriptions validation when present.