Skip to content

Leave a gap after the longest option in --help [patch] - #58

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/56-help-gap
Nov 4, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/56-help-gap

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #56

What was wrong

HelpText.Usage set the description column to the longest row's length + 2. AppendRow then spent those two characters on the leading indent, so the longest row was padded to its own length and ran straight into its description:

  -r, --reason <explanation>Why it is held.

Change

  • The column is sized as indent + option text + a two-space gap, still capped at 34.
  • AppendRow wraps when indent + text + gap doesn't fit, so a row can never be glued to its description.
  • The built-in rows keep their column of 25 (the longest, -f, --for <duration>, is 20 characters).

Tests

  • Usage_LeavesAGapAfterTheLongestOption with a 23-character row (fits the default column), a 26-character row (widens it) and a 33-character row (wraps). The 23 and 26 cases fail on main and pass with the fix.
  • Usage_KeepsTheBuiltInRowsAtTheDefaultColumn pins the built-in layout, continuation line included.
  • Full suite: 164 passed, 1 skipped, 0 failed.

Generated by Claude Code

The description column was the longest row's length + 2, but those two
characters went on the row's leading indent, so a 23-32 character option
ran straight into its description ("-r, --reason <explanation>Why it is
held."). Reserve the indent and a two-space gap when sizing the column and
when deciding to wrap. The built-in rows keep their column of 25.

Fixes #56

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW3e2AZDcKPKkvjAga2
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

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.

--help glues the longest option straight onto its description when it is 23–32 characters: "-r, --reason <explanation>Why it is held."

2 participants