Repository navigation
feat: show subcommands near the top of help output - #70
Merged
Merged
Conversation
sergej-koscejev
force-pushed
the
issue-52-help-order
branch
2 times, most recently
from
October 22, 2026 15:47
72cbb61 to
b8818c3
Compare
…e one-line headers
sergej-koscejev
force-pushed
the
issue-52-help-order
branch
from
October 22, 2026 16:09
b8818c3 to
154d254
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #52
Summary
Command Help is laid out for
mops <cmd> --help | head -N: subcommands and Explain Topics come first, the global options once at the end.Section order is picocli's default with three edits:
Evidence
Before:
mops find --help | head -12ends inside the first subcommand's description;mops examples --helpshows no topics; baremopsprints usage withoutCommands:.After:
mops find --help | head -12lists all five subcommands on lines 4-8;mops examples --helpandmops explain --helplist their topics before the options; baremopsequalsmops --help.New tests in
CommandHelpTest(commands before options for every group, one line perCommands:entry,Global options:last and listing--mps-homeonce,head -12, baremops),ExamplesCommandTestandExplainCommandTest(topics in--help)../gradlew :cli:testpasses.Merge Danger
Door: two-way
Help text only; argument parsing is unchanged.
Blast Radius: help-text
Anything scraping help output (none in this repo's tests) sees new
Options:/Global options:headings and shorter synopses.Decisions
newCommandLine().execute(..., "--help")(CommandHelpTest, ExamplesCommandTest, ExplainCommandTest); no tests against picocli internals.root.helpSectionKeys) by moving or inserting only the keys that change, instead of listing every key.ScopeType.INHERIT(notOptionSpec.inherited()), so the root command's own declarations land inGlobal options:too. They need their own section because picocli copies inherited options to subcommands but not@ArgGroups, so a named option group cannot carry them.Helpsubclass installed withsetHelpFactory); theGlobal options:section documents them, and shorter synopses keepheadoutput short.Options:andParameters:headings so the unlabeled blocks do not sit between labeledCommands:andGlobal options:sections.headeris set only wheredescription[0]does not fit one line in the parent's list; picocli falls back to the description otherwise, and the one-line property is enforced by a test for the root and every group.headersection is removed from each command's own help (picocli would print it aboveUsage:), soheaderserves only the parent'sCommands:list;RecursiveHelpCommandmoved its header text into the description.explainandexamplesinMain.newCommandLine(ExplainTopics.topicList(),ExampleTopics.topicList(), whichindex()reuses), so they precede the option sections and survive--help | head; explain summaries now wrap at 80 columns in bothmops explainand--help.mops(no arguments), which built a freshCommandLineand therefore printed usage without the command list; it now prints the configured usage via@Spec.:cli:testcovers.