Skip to content
Myr

don't show empty multiple=True default

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

authored by Patryk Bęza · committed by David Lord · parent 10611b5 · Browse files · 3 files+14 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+14 added−1 removed

  • tests:+10 added−0 removed
  • other:+4 added−1 removed

3 files+14 added−1 removed

modified:src/click/core.py+2 added-1 removed
2746 unmodified lines
2747 )[1]2748 else:2749 default_string = str(default_value)27502751 if default_string:2751 extra.append(_("default: {default}").format(default=default_string))2752 extra.append(_("default: {default}").format(default=default_string))27532754 if isinstance(self.type, types._NumberRangeBase):2755 range_str = self.type._describe_range()2756
202 unmodified lines
modified:tests/test_options.py+10 added
726 unmodified lines
727 message = opt.get_help_record(ctx)[1]728 assert "[default: None]" not in message729730731def test_do_not_show_default_empty_multiple():732 """When show_default is True and multiple=True is set, it should not733 print empty default value in --help output.734 """735 opt = click.Option(["-a"], multiple=True, help="values", show_default=True)736 ctx = click.Context(click.Command("cli"))737 message = opt.get_help_record(ctx)[1]738 assert message == "values"739740741@pytest.mark.parametrize(742 ("args", "expect"),743 [744 (None, (None, None, ())),
51 unmodified lines
modified:CHANGES.rst+2 added
6 unmodified lines
78- ``is_bool_flag`` is not set to ``True`` if ``is_flag`` is ``False``.9 :issue:`1925`10- Bash version detection is locale independent. :issue:`1940`11- Empty ``default`` value is not shown for ``multiple=True``.12 :issue:`1969`131415Version 8.0.116-------------
889 unmodified lines