-
-
Notifications
You must be signed in to change notification settings - Fork 110
feat: add Description section for specific command help #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds richer, command-specific help output by introducing a dedicated Description section for subcommands, while keeping the main/global help output compact.
Changes:
- Add a “Description” section (full, multi-line) for non-global, non-default command
--helpoutput. - Truncate command descriptions to the first line in the global/default “Commands” listing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Show full description for specific commands (not global/default) | ||
| if (!this.isGlobalCommand && !this.isDefaultCommand && this.description) { | ||
| sections.push({ | ||
| title: 'Description', | ||
| body: this.description | ||
| .split('\n') | ||
| .map((line) => ` ${line}`) | ||
| .join('\n'), | ||
| }) | ||
| } |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New behavior adds a dedicated "Description" section for subcommand help, but there are no tests asserting this output. Since help output is user-facing and already has coverage (e.g., examples/help.js in src/test/index.test.ts), please add a test (snapshot or string assertions) that verifies some-command --help includes the Description section and preserves multi-line descriptions.
src/Command.ts
Outdated
| // Only show first line of description in commands listing | ||
| const firstLine = command.description.split('\n')[0].trim() | ||
| return ` ${padRight( | ||
| command.rawName, | ||
| longestCommandName.length | ||
| )} ${command.description}` | ||
| )} ${firstLine}` |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commands listing now truncates descriptions to the first line. Please add/adjust tests to cover this formatting change (e.g., ensure a multi-line command description only shows the first line in the global/default --help output), so future refactors don't regress the compact help behavior.
c0e8d20 to
0cdb965
Compare
When running
--helpon a specific command, shows a Description section with the full command description.Changes:
command --help--helpcompactExample: