Skip to content

feat: enhance help system with -h/--help distinction, help command, and grouping - #2

Merged
JakiChen merged 3 commits into
mainfrom
enhance-help-system
May 23, 2026
Merged

JakiChen merged 3 commits into
mainfrom
enhance-help-system

Conversation

@JakiChen

Copy link
Copy Markdown
Contributor

Summary

Enhance the help system in clippy CLI framework with the following features:

Changes

  1. Distinguish -h and --help behavior:

    • -h shows brief help (Usage + Commands only)
    • --help shows detailed help (all sections including Options)
  2. Built-in help subcommand:

    • help → displays detailed help for current command
    • help <subcommand> → displays help for specified subcommand
  3. Grouping support for options and arguments:

    • Added group property to OptionDef and ArgDef types
    • Added groupOrder to HelpConfig for ordering groups
    • Added groupTitle style for styled output

Files Changed

  • src/types.ts - Added group?: string to OptionDef and ArgDef
  • src/help.ts - Enhanced HelpConfig with groupOrder, showAllOnBrief, groupTitle style
  • src/command.ts - Added -h/--help distinction and help command handling
  • tests/command.test.ts - Added tests for new help features
  • examples/demo.ts - Updated demo with grouped options example

Testing

  • All 37 tests pass
  • TypeScript type check passes
  • Manual verification completed:
    • demo -h → brief help
    • demo --help → detailed help
    • demo help → detailed help
    • demo help serve → serve subcommand help
    • demo serve -h → brief help for subcommand

@JakiChen can click here to continue refining the PR

…nd grouping

- Add -h for brief help (Usage + Commands only)
- Add --help for detailed help (all sections)
- Add built-in help [command] subcommand
- Add group property for options and arguments
- Add groupOrder configuration for HelpConfig
- Add groupTitle style for styled output
- Update tests and demo with new features
@JakiChen
JakiChen marked this pull request as ready for review May 23, 2026 13:15
@JakiChen
JakiChen merged commit 918469b into main May 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants