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

Is Arg::validator_regex even needed anymore? #3743

Closed
epage opened this issue May 23, 2022 · 1 comment · Fixed by #3756
Closed

Is Arg::validator_regex even needed anymore? #3743

epage opened this issue May 23, 2022 · 1 comment · Fixed by #3756
Labels
A-validators Area: ArgMatches validation logi C-bug Category: Updating dependencies
Milestone

Comments

@epage
Copy link
Member

epage commented May 23, 2022

It was proposed for addition in #1968. That included a workaround but the motivating reason for baking it in was yaml support but that was deprecated in #3087.

With #3732, we are getting support for users to define reusable parsers / validators, rather than having every kind baked in. Users can provide their own validators or a clap_regex crate could be created to provide a general one.

The runtime costs of regex support are only paid for by those enabling the feature. However, there are usability challenges with clap due to how large the API is. If we could cut the Arg::validator_regex, regex feature, and RegexSet, that will help focus the clap API. On top of that, we are deprecating the other validator* functions and this would stand out.

@epage epage added C-bug Category: Updating dependencies A-validators Area: ArgMatches validation logi labels May 23, 2022
@epage epage added this to the 3.x milestone May 23, 2022
@epage
Copy link
Member Author

epage commented May 23, 2022

I had considered adding a RegexValueParser but I wasn't quite happy with the generic error message and the API and realized it could just as well be supported outside of clap as inside and it would reduce the API burden of clap. This led me down this path.

epage added a commit to epage/clap that referenced this issue May 25, 2022
`validator_regex` is being ignored for now as I await on a comment
period for clap-rs#3743
epage added a commit to epage/clap that referenced this issue May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-validators Area: ArgMatches validation logi C-bug Category: Updating dependencies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant