Skip to content
Myr

Merge pull request #1832 from pallets/option-help-space

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

revert adding space between option help

authored by David Lord · committed by GitHub · parents 9330dba, bc21607 · Browse files · 3 files+2 added−40 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+2 added−40 removed

  • tests:+0 added−36 removed
  • other:+2 added−4 removed

3 files+2 added−40 removed

modified:src/click/formatting.py-4 removed
223 unmodified lines
224 self.write(f"{lines[0]}\n")225226 for line in lines[1:]:227 self.write(f"{'':>{first_col + self.current_indent}}{line}\n")228229 if len(lines) > 1:230 # separate long help from next option231 self.write("\n")228 else:229 self.write("\n")230231 @contextmanager
46 unmodified lines
modified:tests/test_formatting.py-36 removed
329 unmodified lines
330 " --help Show this message and exit. [default: False]",331 ]332333334def test_formatting_usage_multiline_option_padding(runner):335 @click.command("foo")336 @click.option("--bar", help="This help message will be padded if it wraps.")337 def cli():338 pass339340 result = runner.invoke(cli, "--help", terminal_width=45)341 assert not result.exception342 assert result.output.splitlines() == [343 "Usage: foo [OPTIONS]",344 "",345 "Options:",346 " --bar TEXT This help message will be",347 " padded if it wraps.",348 "",349 " --help Show this message and exit.",350 ]351352353def test_formatting_usage_no_option_padding(runner):354 @click.command("foo")355 @click.option("--bar", help="This help message will be padded if it wraps.")356 def cli():357 pass358359 result = runner.invoke(cli, "--help", terminal_width=80)360 assert not result.exception361 assert result.output.splitlines() == [362 "Usage: foo [OPTIONS]",363 "",364 "Options:",365 " --bar TEXT This help message will be padded if it wraps.",366 " --help Show this message and exit.",367 ]368369334def test_formatting_with_options_metavar_empty(runner):335 cli = click.Command("cli", options_metavar="", params=[click.Argument(["var"])])336 result = runner.invoke(cli, ["--help"])337 assert "Usage: cli VAR\n" in result.output
modified:CHANGES.rst+2 added
147 unmodified lines
148 ``is_flag=False``, and the value can instead be prompted for or149 passed in as a default value.150 :issue:`549, 736, 764, 921, 1015, 1618`151- Fix formatting when ``Command.options_metavar`` is empty. :pr:`1551`152- Revert adding space between option help text that wraps.153 :issue:`1831`154- The default value passed to ``prompt`` will be cast to the correct155 type like an input value would be. :pr:`1517`156- Automatically generated short help messages will stop at the first157 ending of a phrase or double linebreak. :issue:`1082`
680 unmodified lines