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

Upgrade to clap 3.2 #431

Merged
merged 2 commits into from
Jun 15, 2022
Merged

Upgrade to clap 3.2 #431

merged 2 commits into from
Jun 15, 2022

Conversation

epage
Copy link
Contributor

@epage epage commented Jun 13, 2022

I decided to use cargo-deny as a test case for upgrading to clap 3.2 which was just released (release announcement forthcoming).

For derive users, there isn't too much different. By specifying a default #[clap(action)] or #[clap(value_parser)] attribute, you opt-in to the new behavior that will be the default in clap 4.0. The main difference is instead of the parse attribute that is unique to the derive, you now have the value_parser attribute which comes from Arg::value_parser. When no value_parser is specified, we'll default to value_parser!(T) which will auto-select an appropriate value parser for the given field's core type. In practice, this means the default value_parser for PathBuf is now safe to use.

We also renamed ArgEnum to ValueEnum to make the name more meaningful and for some future work we'll be doing. value_parser mostly gets rid of the need for value_enum attribute except for when dealing with defaults, so I just left the attribute in place. I went ahead and switched some enums that were almost ValueEnum to being ValueEnum.

Copy link
Member

@Jake-Shadle Jake-Shadle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

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.

2 participants