Skip to content
Myr

Merge pull request #1695 from srafi1/help-summary

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

Account for linebreak in help summary

authored by Amy Lei · committed by GitHub · parents 297150c, 17a82fc · Browse files · 3 files+24 added−0 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+24 added−0 removed

  • tests:+19 added−0 removed
  • other:+5 added−0 removed

3 files+24 added−0 removed

modified:src/click/utils.py+3 added
47 unmodified lines
484950def make_default_short_help(help, max_length=45):51 """Return a condensed version of help string."""52 line_ending = help.find("\n\n")53 if line_ending != -1:54 help = help[:line_ending]55 words = help.split()56 total_length = 057 result = []58 done = False
434 unmodified lines
modified:tests/test_basic.py+19 added
526 unmodified lines
527 result = runner.invoke(cli, ["--help"])528 assert result.exit_code == 0529 assert "subgroup" not in result.output530 assert "nope" not in result.output531532533def test_summary_line(runner):534 @click.group()535 def cli():536 pass537538 @cli.command()539 def cmd():540 """541 Summary line without period542543 Here is a sentence. And here too.544 """545 pass546547 result = runner.invoke(cli, ["--help"])548 assert "Summary line without period" in result.output549 assert "Here is a sentence." not in result.output
modified:CHANGES.rst+2 added
145 unmodified lines
146 :issue:`549, 736, 764, 921, 1015, 1618`147- Fix formatting when ``Command.options_metavar`` is empty. :pr:`1551`148- The default value passed to ``prompt`` will be cast to the correct149 type like an input value would be. :pr:`1517`150- Automatically generated short help messages will stop at the first151 ending of a phrase or double linebreak. :issue:`1082`152153154Version 7.1.2155-------------
635 unmodified lines