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

GNATCOLL.Opt_Parse has no concept of argument constraints #54

Open
LordAro opened this issue Apr 6, 2021 · 1 comment
Open

GNATCOLL.Opt_Parse has no concept of argument constraints #54

LordAro opened this issue Apr 6, 2021 · 1 comment
Assignees

Comments

@LordAro
Copy link

LordAro commented Apr 6, 2021

That is, a "built in" way of specifying that if --foo is provided, --bar must also be given. Or --foo cannot be provided with --bar. And similar.

I'm happy to implement this myself and pull-request it, if such a thing is desirable. (Any thoughts on design and implementation of such a thing would be appreciated). I'd probably go with something similar to python's argparse groups - https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_mutually_exclusive_group

@raph-amiard
Copy link
Member

raph-amiard commented Jan 24, 2022

Hi @LordAro,

I'm interested in the feature, albeit a bit wary, and certainly you have approximately 1800% more chances of getting this feature if you have a pull request for it 🙂

My only reservation is whether this is redundant with subcommands (that you also have in Python's argparse: https://docs.python.org/3/library/argparse.html#sub-commands). Most of the time, when I have mutually exclusive group of arguments, the whole argument parser would be better redesigned with subcommands. Would that be the case in your use case, and if not I would be curious to know a bit more about it.

But on a high level we would very much welcome new features and contributions to Opt_Parse, and having a way to express the above seems like a good idea.

Thanks for your time!

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