Example:
@click.command()
@click.option('--mypath', type=click.Path(exists=True), envvar='MYPATH')
def cli(mypath):
click.echo(f'mypath: {mypath}')
Test case:
Observed output:
Usage: mycli.py [OPTIONS]
Try "mycli.py --help" for help.
Error: Invalid value for "--mypath": Path "" does not exist.
Expected output:
➜ ./mycli.py
mypath: None
i.e. Shouldn't Click special-case envvar == "" and treat it as though the option wasn't passed? This is more useful than failing with "Path "" does not exist", as it gives users who are inheriting an unwanted env var, and who can only set it to empty string rather than unset, a way to clear it.
Example:
Test case:
Observed output:
Expected output:
i.e. Shouldn't Click special-case
envvar == ""and treat it as though the option wasn't passed? This is more useful than failing with "Path "" does not exist", as it gives users who are inheriting an unwanted env var, and who can only set it to empty string rather than unset, a way to clear it.