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

Prevent user from using both required and required_unless_present #3660

Closed
2 tasks done
imlazyeye opened this issue Apr 25, 2022 · 0 comments · Fixed by #3701
Closed
2 tasks done

Prevent user from using both required and required_unless_present #3660

imlazyeye opened this issue Apr 25, 2022 · 0 comments · Fixed by #3701
Labels
A-builder C-enhancement E-easy M-breaking-change
Milestone

Comments

@imlazyeye
Copy link

@imlazyeye imlazyeye commented Apr 25, 2022

Please complete the following tasks

Clap Version

3.1.11

Describe your use case

Given the following pattern:

/// The name of the module to be printed
#[clap(required = true, required_unless_present = "list")]
name: Option<String>,

required_unless_present will silently be overruled by required, which is confusing.

Describe the solution you'd like

Ideally, an error is given to the user so that they are made aware of the conflicting derives (specifically, one that points out to them that required_unless_present is sufficient by itself and required is not additionally necessary).

Alternatives, if applicable

No response

Additional Context

Coming from this discussion: #3658

@imlazyeye imlazyeye added the C-enhancement label Apr 25, 2022
@epage epage added M-breaking-change A-builder E-easy labels Apr 25, 2022
@epage epage added this to the 4.0 milestone Apr 25, 2022
epage added a commit to epage/clap that referenced this issue May 6, 2022
epage added a commit to epage/clap that referenced this issue May 6, 2022
epage added a commit to epage/clap that referenced this issue May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builder C-enhancement E-easy M-breaking-change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants