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

Support conflicts_with with flattened field. #526

Open
ababo opened this issue Mar 25, 2022 · 1 comment
Open

Support conflicts_with with flattened field. #526

ababo opened this issue Mar 25, 2022 · 1 comment

Comments

@ababo
Copy link

ababo commented Mar 25, 2022

I would like to have an ability to do something like this:

    #[structopt(long, conflicts_with = "bar")]
    pub foo: bool,

    #[structopt(flatten)]
    pub bar: BarParams,

This means that if foo flag is set no flag from bar can be used.

@epage
Copy link
Contributor

epage commented Mar 25, 2022

As a heads up, structopt is in maintenance mode at this point and new development is happening in clap.

As for this specific request, this falls into a derive-implementation challenge. This requires some form of cross-struct communication. As immediately presented, we'd need a way to apply the bar group name to all of BarParams fields. Say we instead have BarParams implicitly create a group named BarParams. The challenge there is then with if the user does a flatten within BarParams, we'd need to recursively apply the group name which goes back to that first problem

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

No branches or pull requests

2 participants