Skip to content

Make --help and report output fit an 80-column terminal - #10

Merged
lazarevtill merged 1 commit into
mainfrom
help-width
Aug 23, 2026
Merged

Make --help and report output fit an 80-column terminal#10
lazarevtill merged 1 commit into
mainfrom
help-width

Conversation

@lazarevtill

Copy link
Copy Markdown
Member

A UI audit of every script's terminal output. One real defect, found in 40 places; everything else audited was already correct.

Width

Every script's --help overflowed 80 columns. A heredoc is emitted verbatim — nothing reflows it the way PowerShell's Get-Help reflows a description — so an over-long line wraps mid-word in a default terminal.

The worst were not written long, they grew. fix_dnf_lock interpolated its lock-path list straight into the heredoc and printed 216 columns; fix_apt_lock did the same at 106 and clean_logs at 101, and each gains another column-run every time a default gains an entry. Those go through a new wrap_list helper. clean_logs uses it for the runtime Patterns line too, with continuations indented to line up under the first pattern.

The rest is reflowed prose, plus five log messages shortened. Those were shortened rather than wrapped deliberately: a log line is one event, and folding it breaks both grep and the log file.

Left long on purpose

File paths in the fix_permissions change list, the exact useradd argv in the exporter installer's dry run, and free(1)'s memory table. Those are data, not prose — wrapping a path makes it un-copy-pasteable and un-greppable, and reformatting another program's output would be worse than letting the terminal wrap it.

Audited and already correct — unchanged

  • No escape sequences leak when stdout is not a terminal.
  • NO_COLOR and --color never both honoured; --color always works through a pipe.
  • Every colour start has a matching reset, in every script.
  • --help goes to stdout, errors to stderr, unknown flag exits 2 — everywhere.
  • Label columns line up in every report block (the only outliers are free's own output).

Regression guard

tests/run_checks.sh gains a width check, since this accumulated unnoticed precisely for want of one. Verified it fails on a deliberately over-long line and passes on the tree as it stands.

PowerShell

Comment-based help runs 81–88 columns in source, but Get-Help reflows description text to the console width, so it is not emitted verbatim the way a heredoc is. There is no pwsh on this machine to confirm that against, so those files are left alone rather than churned on an untested assumption.

Every script's --help overflowed 80 columns -- 40 lines across 12 scripts. A
heredoc is emitted verbatim, so nothing reflows it the way PowerShell's
Get-Help reflows a description: an over-long line wraps mid-word in a default
terminal, and the generated ones get worse on their own.

The worst were not written long, they grew. fix_dnf_lock interpolated its lock
path list straight into the heredoc and printed 216 columns; fix_apt_lock did
the same at 106 and clean_logs at 101, and each would gain another column-run
every time a default gained an entry. Those three now go through a wrap_list
helper, which folds a whitespace-separated list into indented lines within a
width budget. clean_logs uses it for the runtime "Patterns" line too, with
continuations indented to the label so they line up under the first pattern
rather than under the label.

The rest is reflowed prose and option text, plus five log messages shortened
to fit. Those were shortened rather than wrapped on purpose: a log line is one
event, and folding it would break both grep and the log file.

What is deliberately left long: file paths in the fix_permissions change list,
the exact useradd argv in the exporter installer's dry run, and free(1)'s
memory table. Those are data, not prose. Wrapping a path makes it
un-copy-pasteable and un-greppable, and reformatting another program's output
would be worse than letting the terminal wrap it.

tests/run_checks.sh gains a width check, because this accumulated unnoticed
precisely for want of one. Verified it fails on a deliberately over-long line
and passes on the tree as it stands.

Also audited and found already correct, so unchanged: no escape sequences leak
when stdout is not a terminal, NO_COLOR and --color never are both honoured,
every colour start has a matching reset across every script, --help goes to
stdout while errors go to stderr, and an unknown flag exits 2 everywhere.

The PowerShell comment-based help runs 81-88 columns in source, but Get-Help
reflows description text to the console width, so those are not emitted
verbatim the way a heredoc is. No pwsh here to confirm that against, so they
are left alone rather than churned on an untested assumption.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sonarqubecloud

Copy link
Copy Markdown

@lazarevtill
lazarevtill merged commit 67e8dcb into main Aug 23, 2026
8 checks passed
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