Skip to content

Wrap long synopsis lines at terminal width #457

@stalep

Description

@stalep

Summary

The synopsis line renders as a single line regardless of length. For commands with many options, this produces lines that are hundreds of characters long and extend far beyond the terminal width.

Current output

Usage: jbang run [-hinx] [-R=<runtime-option>] [--jfr] [-d=<debug>] [--enableassertions] [--enablesystemassertions] [--javaagent=<javaagent>] [--cds] [-c] [-s=<sources>] [--files=<files>] [-T=<source-type>] [--jsh] [--catalog=<catalog>] [-j=<java>] [-m=<main>] [--module] [-C=<compile-option>] [--manifest=<manifest>] [--integrations] [-D=<properties>] [--deps=<deps>] [--repos=<repos>] [--cp=<cp>] [--ignore-transitive-repositories] [-N=<native-option>] [--build-dir=<build-dir>] [--enable-preview] [--config=<config>] [--insecure] [--verbose | --quiet] [-o | --fresh] [--preview] [<scriptOrFile>] [<userParams>...]

That is 617 characters — well beyond any standard terminal width.

Expected output (picocli style)

Usage: jbang run [-hinx] [-R=<runtime-option>] [--jfr] [-d=<debug>]
                 [--enableassertions] [--enablesystemassertions]
                 [--javaagent=<javaagent>] [--cds] [-c] [-s=<sources>]
                 [--files=<files>] [-T=<source-type>] [--jsh]
                 [--catalog=<catalog>] [-j=<java>] [-m=<main>] [--module]
                 ...

The continuation lines should be indented to align with the first option after the command name.

Details

The wrapping width should ideally respect the terminal width (defaulting to 80 columns when unknown). Options should not be split mid-token — wrapping should occur between option groups.

Context

Found in jbang (jbangdev/jbang#2453). Picocli wrapped the synopsis at ~80 columns with continuation indentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions