Skip to content

Commit efdc553

Browse files
committed
refactor: simplify blank line handling in extract_description
Remove unnecessary last_was_empty tracking logic. Click's help formatter already produces well-formatted output, so we only need to: - Append non-empty stripped lines - Preserve blank lines for paragraph separation (if we have content) This addresses reviewer feedback and makes the code cleaner and more maintainable.
1 parent d57d048 commit efdc553

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

dev/generate_cli_docs.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ def extract_description(help_text: str) -> str:
175175
# Find the description between usage and options/commands
176176
description_lines = []
177177
in_description = False
178-
last_was_empty = False
179178

180179
for line in lines:
181180
if line.startswith("Usage:"):
@@ -187,12 +186,8 @@ def extract_description(help_text: str) -> str:
187186
stripped = line.strip()
188187
if stripped:
189188
description_lines.append(stripped)
190-
last_was_empty = False
191-
else:
192-
# Blank line - preserve as paragraph separator, avoid duplicates
193-
if description_lines and not last_was_empty:
194-
description_lines.append("")
195-
last_was_empty = True
189+
elif description_lines: # Preserve blank line only if we have content
190+
description_lines.append("")
196191

197192
# Simply join with single newline - let Markdown handle paragraph formatting naturally
198193
description = "\n".join(description_lines) if description_lines else ""

0 commit comments

Comments
 (0)