Skip to content

Commit c0e8d20

Browse files
committed
feat: add Description section for specific command help
- Show full description in Description section when running --help on a specific command - Only show first line in commands listing for compact root --help
1 parent 257b140 commit c0e8d20

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Command.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,17 @@ class Command {
149149
body: ` $ ${name} ${this.usageText || this.rawName}`,
150150
})
151151

152+
// Show full description for specific commands (not global/default)
153+
if (!this.isGlobalCommand && !this.isDefaultCommand && this.description) {
154+
sections.push({
155+
title: 'Description',
156+
body: this.description
157+
.split('\n')
158+
.map((line) => ` ${line}`)
159+
.join('\n'),
160+
})
161+
}
162+
152163
const showCommands =
153164
(this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0
154165

@@ -160,10 +171,12 @@ class Command {
160171
title: 'Commands',
161172
body: commands
162173
.map((command) => {
174+
// Only show first line of description in commands listing
175+
const firstLine = command.description.split('\n')[0].trim()
163176
return ` ${padRight(
164177
command.rawName,
165178
longestCommandName.length
166-
)} ${command.description}`
179+
)} ${firstLine}`
167180
})
168181
.join('\n'),
169182
})

0 commit comments

Comments
 (0)