Skip to content

Wrap usage descriptions as whole paragraphs - #372

Merged
CLHatch merged 4 commits into
mainfrom
usage-paragraph-wrap
Nov 29, 2026
Merged

CLHatch merged 4 commits into
mainfrom
usage-paragraph-wrap

Conversation

@CLHatch

@CLHatch CLHatch commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Usage descriptions wrapped each source line on its own at 75 columns. A description split over several lines, or a line a little over the width, left short leftover rows and ragged line lengths, as in -c status and the server and web server commands. Long hand-aligned lines, such as --ansi-override's <slot> list, weren't wrapped at all and ran to the terminal's edge.

  • Each paragraph in the usage text is now one string that paragraph() wraps. Separate strings are separate points or list items, such as --tint's <ref> forms.
  • printStr wraps each string on its own.
  • A hand-aligned line keeps its spacing while it fits and wraps at its own indent when it doesn't.
  • Paragraphs that were split over lines are joined, with missing full stops added where two sentences now meet.

The rendered usage differs from before only where a ragged paragraph now flows evenly or a long line now wraps. A new test checks that every description row fits the width, that a paragraph flows evenly, that list items stay on their own rows, and that a long hand-aligned line wraps at its indent. Confirmed live on a Linux test host.

Each description line was wrapped on its own at 75 columns, so a
description split over several source lines, or one line a little over
the width, left short leftover rows and ragged line lengths. Description
lines that follow each other in one entry now join into one paragraph
before wrapping. Header lines and hand-aligned lines are still written as
they are and end the paragraph.
Joining every description line ran separate points and lists together,
such as --tint's <ref> forms and --app-template-extract's notes. A line
now continues the paragraph only when it starts with a lowercase letter
or "("; one starting with a capital or a tag starts a new point.
Instead of guessing which description lines continue a sentence, each
paragraph in the usage text is now one string that paragraph() wraps;
separate strings are separate points or list items, such as --tint's
<ref> forms. printStr wraps each string on its own again.
A hand-aligned line was always written as it was, so one wider than the
usage width, such as --ansi-override's <slot> list, ran on to the
terminal's edge. It still keeps its spacing while it fits; when it
doesn't, it wraps with its continuation rows at its own indent.
@sourcery-ai

sourcery-ai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Sorry @CLHatch, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 23 hours and 43 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@CLHatch
CLHatch merged commit 52a1317 into main Nov 29, 2026
6 checks passed
@CLHatch
CLHatch deleted the usage-paragraph-wrap branch November 29, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant