Skip to content
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

feat(parser): Make customizeing flags easier #4095

Merged
merged 2 commits into from
Aug 19, 2022
Merged

Conversation

epage
Copy link
Member

@epage epage commented Aug 19, 2022

While TypedValueParser will generally make it easier to reuse value
parsers, this was particularly written for flags. Besides having a
concrete API to document, an advantage over fn(&str) -> Result<bool, E>
value parsers is you get all of the benefits of the existing value
parsers for environment variable parsing.

epage added 2 commits August 18, 2022 22:08
While `TypedValueParser` will generally make it easier to reuse value
parsers, this was particularly written for flags.  Besides having a
concrete API to document, an advantage over `fn(&str) -> Result<bool, E>`
value parsers is you get all of the benefits of the existing value
parsers for environment variable parsing.
@epage epage merged commit e81b1aa into clap-rs:master Aug 19, 2022
@epage epage deleted the flag branch August 19, 2022 13:35
epage added a commit to epage/clap that referenced this pull request Sep 12, 2022
This is a partial backport of clap-rs#4095.  This was written to allow mapping
bools to other types but this will be useful for people using
`PossibleValue` with non-string types to upgrade to value parsers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant