Skip to content

cmd/morphic: root help pads the command column to a magic width #232

Description

@fuad-daoud

Noticed while reviewing #204.

writeRootHelp renders the command list with a hardcoded column:

emitf(w, "  %-9s %s\n", c.name, c.summary)

9 is wide enough for compile and nothing else justifies it. The second subcommand with a longer name will silently push its summary out of alignment, and the golden added in #207 will record the misalignment as the expected output rather than flag it.

Deriving the width from the longest name in the table is a few lines and removes the trap. Not worth doing for a one-command table; worth doing before the table grows.

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