feat(help): line the flag column up, and give the short page a column at all - #912
Conversation
… at all Two findings from putting communique's help next to clap's, both about the same column. **The long forms did not line up.** Everything started at column 2, so `--github-release` and `-n --dry-run` began in the same place and the names ran ragged. clap spends a four-character column on `-n, ` — or the blank standing in for it — and the long forms line up whatever precedes them. Measured from clap 4, including the two rules that are easy to get wrong: the column is only spent where there is a long form to line up *with*, so `-j <JOBS>` does not pad; and a flag whose declared name the forms do not imply (`verbose: -v`, which clap has no equivalent for) takes that same path. **The short page had no column.** Every description began directly after the name it belonged to, so nothing in `-h` lined up with anything — and `-h` is the form most people type. It now computes one column per section over its visible entries, which is the rule the long page already followed. Built separately from `flag_usage`, which feeds the usage line: `Usage: ex [ --describe]` would be absurd, and a test says so. Landed in usage-lib and usage-argv together, so the gate still holds them byte-identical over mise's 211 commands. `communique generate -h` is now byte-for-byte clap's output except for the word `Flags:`, which is the one difference we chose to keep. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR aligns flag forms into a clap-style short/long column and adds per-section description columns to short help.
Confidence Score: 4/5The PR is not yet safe to merge because whitespace-only help still produces divergent output between the two CLI-help renderers. The short Tera template checks raw help-string truthiness, while the argv renderer trims before checking emptiness, so equivalent whitespace-only metadata continues to break the renderer-parity contract. Files Needing Attention: lib/src/docs/cli/templates/spec_template_short.tera Important Files Changed
Reviews (2): Last reviewed commit: "feat(help): line the flag column up, and..." | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5d0d943. Configure here.
5d0d943 to
5a8febf
Compare
5a8febf to
5d0d943
Compare

PR 1 of the help plan. Two findings from putting communique's help next to clap's.
The long forms did not line up
Everything started at column 2:
clap spends a four-character column on
-n,— or the blank standing in for it:Measured from clap 4, including the two rules that are easy to get wrong:
-j <JOBS>writes at the indent and does not pad — that is clap's behaviour, not an oversight in it.verbose: -v, which clap has no equivalent for — takes that same path.The short page had no column at all
This is the one I did not plan for and think matters more.
-hwas:Every description began directly after the name it belonged to, so nothing in
-hlined up with anything — and-his the form most people type. It now computes one column per section over its visible entries, the rule the long page already followed.Result
communique generate -his now byte-for-byte clap's output except the wordFlags:, which is the difference we chose to keep:Notes
Built as
column_usage, separate fromflag_usagewhich feeds the usage line —Usage: ex [ --describe]would be absurd, and a test says so. In usage-lib the same split lives besidedisplay_usage, which only the two CLI help templates read;SpecFlag::usage()is untouched, so markdown and manpage are unaffected.Landed in both renderers, so the gate still holds them byte-identical over mise's 211 commands.
Verification
Snapshots accepted where the change is the intended one (descriptions moving into a column); two
lib/tests/parse.rsexpectations updated for the same reason. Workspace suite green, clippy clean.AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: unavailable.
Note
Low Risk
Presentation-only help formatting in two renderers; parsing and spec
usage()for markdown/man are unchanged aside from aligned CLI help text.Overview
Help output is updated so flag sections match clap 4 layout: a fixed four-character short column (
-n,or blank), long--options starting in one column, and short-only flags like-j <JOBS>left unpadded. That logic lives in newcolumn_usage, separate from usage-lineflag_usagesoUsage:stays compact.Short help (
-h) now pads Arguments and Flags into per-section columns (max visible entry width + two spaces before help), matching what long help already did. Empty help text skips padding.usage-lib applies the same
column_usageforSpecFlag::display_usage, uses it for column-width math, and updates short/long Tera templates (ljuston args/flags). Snapshots and parse help expectations reflect the new spacing.Conformance adds
flag_column.rstests (alignment, comma, short-only, short-page columns, unpadded usage line).Reviewed by Cursor Bugbot for commit 5a8febf. Bugbot is set up for automated code reviews on this repo. Configure here.