I have a python-click CLI with subcommand test. The option choices in function test accepts V1 or V2 (uppercase).
@click.command(name='test')
@click.option('-c', '--choices', type=click.Choice(['V1', 'V2']), default='V1')
def test(choices):
print(choices)
If a user accidentally types v1 (lowercase) instead of V1 (uppercase) then I get an error from click library.
Error: Invalid value for "-c" / "--choices": invalid choice: v1. (choose from V1, V2)
How can I have a case insensitive click.Choice implementation so that even if I type v1 (lowercase) I get V1 (uppercase) in the function?