Skip to content
Myr

Merge pull request #1551 from yo-main/7.x

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

authored by David Lord · committed by GitHub · parents 8efb348, 42ee8a1 · Browse files · 3 files+8 added−2 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+8 added−2 removed

  • tests:+6 added−0 removed
  • other:+2 added−2 removed

3 files+8 added−2 removed

modified:src/click/core.py+1 added-1 removed
1137 unmodified lines
1138 def collect_usage_pieces(self, ctx):1139 """Returns all the pieces that go into the usage line and returns1140 it as a list of strings.1141 """1142 rv = [self.options_metavar]1142 rv = [self.options_metavar] if self.options_metavar else []1143 for param in self.get_params(ctx):1144 rv.extend(param.get_usage_pieces(ctx))1145 return rv1146
1454 unmodified lines
modified:tests/test_formatting.py+6 added
348 unmodified lines
349 "Options:",350 " --bar TEXT This help message will be padded if it wraps.",351 " --help Show this message and exit.",352 ]353354355def test_formatting_with_options_metavar_empty(runner):356 cli = click.Command("cli", options_metavar="", params=[click.Argument(["var"])])357 result = runner.invoke(cli, ["--help"])358 assert "Usage: cli VAR\n" in result.output
modified:CHANGES.rst+1 added-1 removed
142 unmodified lines
143- Providing the value to an option can be made optional through144 ``is_flag=False``, and the value can instead be prompted for or145 passed in as a default value.146 :issue:`549, 736, 764, 921, 1015, 1618`147- Fix formatting when ``Command.options_metavar`` is empty. :pr:`1551`148148149Version 7.1.2150-------------151152Released 2020-04-27
633 unmodified lines