Open
Description
If I have two options sharing the same variable name, like this:
#!/usr/bin/env python
import click
from click_option_group import optgroup, MutuallyExclusiveOptionGroup
@click.command()
@click.pass_context
@optgroup.group('Output format', cls=MutuallyExclusiveOptionGroup)
@optgroup.option(
"--text", "output_format", flag_value="text", default=True,
)
@optgroup.option(
"--json", "output_format", flag_value="json",
)
def mycommand(ctx, *, output_format, **kwargs):
print(output_format)
if __name__ == '__main__':
mycommand()
The mutual exclusive option group doesn't work - whichever option is specified last on the command line wins:
$ python ./mycommand.py --json --text
text
This may be difficult to solve, but here's my completely custom hack for making it work: koordinates/kart#106
Maybe elements of that solution could be incorporated into this project?