Skip to content

The help does not wrap the HelpSectionProvider header/footer #763

Closed

Description

@maxandersen

What

The help wraps the one-line command description and the option descriptions at the help width (#736 / #737), but the header and footer coming from a HelpSectionProvider (or the @CommandDefinition header/footer) are injected verbatim — they are never wrapped.

In AeshCommandLineParser, injectHeader(...) only runs resolveDescriptionVariables(...) on the header content and splices it into the help text; there is no wrap pass like the one descriptions get. So a provider that returns a prose paragraph has to pre-wrap it with hard \n, and those breaks are then stuck at whatever column the author guessed.

Why it matters

Since #758 the rest of the help follows the live terminal width, so a pre-wrapped header is now wrong on both sides:

  • wide terminal: prose stays wrapped at ~80 while everything else uses the full width;
  • narrow terminal: prose overruns the width while the options below it wrap correctly.

A provider can't fix this itself: HelpContext carries command/name/fullName/format but not the resolved width, so getHeader(HelpContext) has no way to wrap at the right column without re-implementing the aesh.help.width → COLUMNS → terminal → 80 resolution that #758 just centralized.

Repro

A command whose HelpSectionProvider.getHeader() returns a long paragraph with no \n:

Creates a new script from a template, ready to run with `jbang <file>`. The template is picked from the file extension unless you choose one with --template; ... (one long line)

--help at COLUMNS=100 and at COLUMNS=60 prints that paragraph identically as a single unwrapped line, while the option descriptions directly below it wrap to the width.

Proposal

Wrap the injected header and footer at the resolved help width, reusing the same wrap logic as the description/option wrapping (#737) and the width resolution from #758. A hard \n already in the text should still be honored as an explicit break; only the soft wrapping is added. Then providers can return plain sentences and let aesh wrap them like everything else.

Related: #736 / #737 (wrap long descriptions), #758 (resolve help width from the terminal).

Activity

  1. stalep commented on Nov 11, 2026

    @stalep
    Member

    Implemented: header/footer text (provider or annotation) now wraps at the resolved help width using the same wrapping as descriptions, with hard line breaks kept as explicit breaks. Applies at both header positions and the footer. No HelpContext change needed — wrapping happens server-side at render time.

  2. added a commit that references this issue on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions