Is it possible to specify two input types for a click.option, one of which the supplied value has to be in?
In a normal python function with typing, I'd declare it like so:
from typing import Union
def fun(x: Union[int, str]):
if isinstance(x, str):
x = int(x)
return x**2
so x should be either an int or str.
In click I want to achieve the same thing, just with the addition that the script fails when the input type isn't in the defined ones.
I've tried
@click.option('-x', type=(click.INT, click.STRING))
but that seems to be only for occasions with multiple arguments.