diff options
author | David Lord <davidism@gmail.com> | 2022-03-28 10:25:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-28 10:25:04 -0700 |
commit | 20c88f02788586a80e6d867854c8313eaba5ad6e (patch) | |
tree | 60bcd4eb1a1b31133fdae783787a1c3ecd811328 /src | |
parent | ef11be6e49e19a055fe7e5a89f0f1f4062c68dba (diff) | |
parent | 8d7f03dac8739afed890af0c0921965786c5e83c (diff) | |
download | click-20c88f02788586a80e6d867854c8313eaba5ad6e.tar.gz |
Merge pull request #2223 from pallets/env-var
treat empty auto_envvar as None
Diffstat (limited to 'src')
-rw-r--r-- | src/click/core.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/click/core.py b/src/click/core.py index 939ad81..18431cd 100644 --- a/src/click/core.py +++ b/src/click/core.py @@ -2834,7 +2834,10 @@ class Option(Parameter): envvar = f"{ctx.auto_envvar_prefix}_{self.name.upper()}" rv = os.environ.get(envvar) - return rv + if rv: + return rv + + return None def value_from_envvar(self, ctx: Context) -> t.Optional[t.Any]: rv: t.Optional[t.Any] = self.resolve_envvar_value(ctx) |