Skip to content
Myr

Don't include envvar in error hint when envvar not configured (#2972)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Rowlando13 · committed by GitHub · parents c88f333, d1f8651 · Browse files · 3 files+9 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+9 added−1 removed

  • tests:+7 added−0 removed
  • other:+2 added−1 removed

3 files+9 added−1 removed

modified:src/click/core.py+1 added-1 removed
2680 unmodified lines
2681 return info_dict26822683 def get_error_hint(self, ctx: Context) -> str:2684 result = super().get_error_hint(ctx)2685 if self.show_envvar:2685 if self.show_envvar and self.envvar is not None:2686 result += f" (env var: '{self.envvar}')"2687 return result26882689 def _parse_decls(
489 unmodified lines
modified:tests/test_options.py+7 added
675 unmodified lines
676 result = runner.invoke(cli)677 assert result.exit_code == 2678 assert "Error: Missing option '--foo' (env var: 'bar')." in result.output679680 cli = click.Command(681 "cli", params=[click.Option(["--foo"], show_envvar=True, required=True)]682 )683 result = runner.invoke(cli)684 assert result.exit_code == 2685 assert "Error: Missing option '--foo'." in result.output686687688def test_case_insensitive_choice(runner):689 @click.command()690 @click.option("--foo", type=click.Choice(["Orange", "Apple"], case_sensitive=False))691 def cmd(foo):
764 unmodified lines
modified:CHANGES.rst+1 added
13 unmodified lines
14- Use the value of ``Enum`` choices to render their default value in help15 screen. Refs :issue:`2911` :pr:`3004`16- Fix completion for the Z shell (``zsh``) for completion items containing17 colons. :issue:`2703` :pr:`2846`18- Don't include envvar in error hint when not configured. :issue:`2971` :pr:`2972`19- Fix a rare race in ``click.testing.StreamMixer``'s finalization that manifested20 as a ``ValueError`` on close in a multi-threaded test session.21 :issue:`2993` :pr:`2991`22
1245 unmodified lines