feat: add Description section for specific command help#167
feat: add Description section for specific command help#167remorses wants to merge 1 commit intocacjs:masterfrom
Conversation
There was a problem hiding this comment.
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'), | ||
| }) | ||
| } |
There was a problem hiding this comment.
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}` |
There was a problem hiding this comment.
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: