From 4cf7c6cdb10e441da775b4a3a7ee55caec83249e Mon Sep 17 00:00:00 2001 From: David Lord Date: Thu, 6 Jul 2023 11:11:38 -0700 Subject: [PATCH] completion works for expose_value=False --- CHANGES.rst | 1 + src/click/shell_completion.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 639f2f7c5..b11e7d513 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -32,6 +32,7 @@ Unreleased - Remove outdated and unnecessary detection of App Engine environment. :pr:`2554` - ``echo()`` does not fail when no streams are attached, such as with ``pythonw`` on Windows. :issue:`2415` +- Argument with ``expose_value=False`` do not cause completion to fail. :issue:`2336` Version 8.1.3 diff --git a/src/click/shell_completion.py b/src/click/shell_completion.py index 731be65c6..5de124702 100644 --- a/src/click/shell_completion.py +++ b/src/click/shell_completion.py @@ -443,7 +443,8 @@ def _is_incomplete_argument(ctx: Context, param: Parameter) -> bool: return False assert param.name is not None - value = ctx.params[param.name] + # Will be None if expose_value is False. + value = ctx.params.get(param.name) return ( param.nargs == -1 or ctx.get_parameter_source(param.name) is not ParameterSource.COMMANDLINE