Skip to content
Myr

Fix formatting issue when last line of docstring is blank

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

authored by Simon Jagoe · committed by Markus Unterwaditzer · parent 61cf523 · Browse files · 2 files+22 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

2 files+22 added−1 removed

  • tests:+21 added−0 removed
  • other:+1 added−1 removed

2 files+22 added−1 removed

modified:click/formatting.py+1 added-1 removed
18 unmodified lines
192021def add_subsequent_indent(text, subsequent_indent):22 lines = text.splitlines()23 lines = [lines[0]] + [subsequent_indent + line for line in lines[1:]]23 lines = lines[:1] + [subsequent_indent + line for line in lines[1:]]24 return '\n'.join(lines)252627def wrap_text(text, width=78, initial_indent='', subsequent_indent='',
224 unmodified lines
modified:tests/test_formatting.py+21 added
85 unmodified lines
86 '',87 'Options:',88 ' --help Show this message and exit.',89 ]909192def test_formatting_empty_help_lines(runner):93 @click.command()94 def cli():95 """Top level command9697 """9899 result = runner.invoke(cli, ['--help'])100 assert not result.exception101 assert result.output.splitlines() == [102 'Usage: cli [OPTIONS]',103 '',104 ' Top level command',105 '',106 '',107 '',108 'Options:',109 ' --help Show this message and exit.',110 ]