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

Xor is ignored with positional arguments #255

Open
mitar opened this issue Dec 22, 2021 · 4 comments
Open

Xor is ignored with positional arguments #255

mitar opened this issue Dec 22, 2021 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mitar
Copy link
Contributor

mitar commented Dec 22, 2021

I would like to do something like:

run --defaults

or:

run foo bar

but prevent:

run --defaults foo bar

It seems xor for positional arguments (flag with arg:"") does not do anything: there is no error if both are provided.

@alecthomas
Copy link
Owner

That's correct, xor is currently only applicable to flags. Seems reasonable though.

@alecthomas alecthomas added enhancement New feature or request help wanted Extra attention is needed labels Feb 2, 2022
@everdrone
Copy link

I'm trying to add a --version flag, with that flag no positional arguments are required
what would be the correct way of doing that if xor ignores positionals?

@mitar
Copy link
Contributor Author

mitar commented Jun 23, 2022

Use VersionFlag.

@WillAbides
Copy link
Contributor

I have a need for this as well.

@alecthomas, you said "Seems reasonable though", but that was a while ago. Before I start diving into this, are you still open to a PR for to include positional arguments in xor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants