Skip to content

A command's Long description does not wrap; only flag usage does #759

Closed

Description

@David-Noble-at-work

Feature: #834 — Help and reference: wrapped help, generated CLI docs, the specification

#755 made flag usage wrap to the terminal. A command's Long description still does not.

Measured

$ COLUMNS=60 writ status --help | awk 'length > 60'
82: Report deployed state: what should be present, where it should have come from, and
81: The report is derived from the store (the run index plus the persisted graphs and
83: traces) — never from a directory scan — and has four sections: the registered layer
80: tree, the deployed inventory classified against the live filesystem, the package

Flag usage wraps at 60; Long runs to 83. Cobra prints Long verbatim through its template, and #755's
wrapper is registered against FlagUsages alone.

Why it was left out of #755

Long is hand-authored prose with intentional shape. writ verify's describes a policy ladder as an
indented list; several commands embed examples. Reflowing it with the same word-wrapper would fold those
into paragraphs and destroy exactly what makes them readable -- the failure #755 avoided for the --output
rendering table, in a place with more variety and less regular structure.

What a fix has to decide

  1. Which text is reflowable. A paragraph wants wrapping; an indented block, an example, and a list do
    not. wrapUsageLine's hanging-indent rule already distinguishes a name column from prose and may be
    enough, or Long may need a convention -- an indented line is verbatim, an unindented one is prose.
  2. Whether the authored line breaks are load-bearing. Today every Long is hand-wrapped to some width
    the author chose. Reflowing means those breaks stop meaning anything, which is the point, but it also
    means a badly-shaped Long starts looking worse rather than better.
  3. Where it hooks. Cobra's template prints {{.Long}}; the same AddTemplateFunc seam that Help text does not wrap: pflag is given no width, so every line length is maintained by hand #755 used
    works here.

Verification

  • COLUMNS=60 writ status --help produces no line over 60, Long included.
  • writ verify --help keeps its policy ladder indented and one entry per line.
  • A command whose Long embeds an example keeps the example's line breaks.

Ticked 2026-09-21. wrapLong in cmd/internal/cli/root.go, on the shared root's help template beside #755's
wrappedFlagUsages: an unindented line is prose and reflows; an indented line is structure and keeps its break.
status was retired since (#782); its successor reconcile carries the same Long, and at COLUMNS=60 no line of
it is over 60 on darwin, linux/arm64 and windows/arm64. writ workflow verify --help keeps the ladder one entry per
line; writ deploy --help its conflict table; indented examples keep their breaks by the same rule. Two lines of
writ reconcile --help remain over 60 and neither is Long: the Example: slot, which cobra prints verbatim, and a
flag-usage line whose unbreakable token is --config's default path — findings for placement. §12 of the
specification states the rule. Plan: docs/plans/feature/759-long-wraps.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area:CLICommand-line interfaceEpic:CommandLineOne output convention across every CLI in the suiteenhancementNew feature or requesttaskImplementation work item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions