Repository navigation
feat: enhance help system with -h/--help distinction, help command, and grouping - #4
Merged
Merged
Conversation
- Added options and args fields to SubcommandInfo interface - In detailed mode, commands show their own [options] and args - In brief mode (-h), commands show only name without usage - deploy now shows: deploy [options] <env> [tag]
JakiChen
marked this pull request as ready for review
May 23, 2026 15:01
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 without usage) - 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 outputSubcommand usage snippets:
[options]and args in detailed mode-h), subcommands show only name without usageFiles Changed
src/types.ts- Addedgroup?: stringto OptionDef and ArgDefsrc/help.ts- Enhanced HelpConfig with groupOrder, groupTitle style; SubcommandInfo now includes options/argssrc/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 likedeploy [options] <env> [tag])demo help→ detailed helpdemo help serve→ serve subcommand help@JakiChen can click here to continue refining the PR