Repository navigation
feat: enhance help system with -h/--help distinction, help command, and grouping - #3
Merged
Merged
Conversation
- -h shows brief mode: no Arguments, no option hints, commands without usage - --help shows detailed mode: Arguments, option hints, commands with usage snippets - Commands section hint uses -h or --help depending on mode - Arguments section shows 'Arguments:' header in detailed mode only - Fixed command name width calculation for proper alignment
JakiChen
marked this pull request as ready for review
May 23, 2026 14:04
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.
Summary
Enhance the help system in clippy CLI framework with the following features:
Changes
Distinguish
-hand--helpbehavior:-hshows brief help (Usage + Options flags+desc + Commands) - no Arguments section, no option hints--helpshows detailed help (Usage + Arguments + Options with hints + Commands with usage snippets)Built-in
helpsubcommand:help→ displays detailed help for current command (same as--help)help <subcommand>→ displays help for specified subcommandGrouping support for options and arguments:
groupproperty toOptionDefandArgDeftypesgroupOrdertoHelpConfigfor ordering groupsgroupTitlestyle for styled outputFiles Changed
src/types.ts- Addedgroup?: stringto OptionDef and ArgDefsrc/help.ts- Enhanced HelpConfig with groupOrder, groupTitle style; formatHelp supportsdetailedparamsrc/command.ts- Added -h/--help distinction, help command handling, error hints use-htests/command.test.ts- Added tests for new help featuresexamples/demo.ts- Updated demo with grouped options exampleTesting
demo -h→ brief help (no Arguments, no option hints, commands without usage)demo --help→ detailed help (Arguments, option hints, commands with usage snippets)demo help→ detailed helpdemo help serve→ serve subcommand helpdemo serve -h→ brief help for subcommand@JakiChen can click here to continue refining the PR