Skip to content

Commit de12d11

Browse files
committed
fix: render default arg/opt if equal to 0
1 parent 095b4b4 commit de12d11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/command.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default class CommandHelp {
100100
const body = renderList(args.map(a => {
101101
const name = a.name.toUpperCase()
102102
let description = a.description || ''
103-
if (a.default) description = `[default: ${a.default}] ${description}`
103+
if (a.default !== '' && a.default !== undefined) description = `[default: ${a.default}] ${description}`
104104
if (a.options) description = `(${a.options.join('|')}) ${description}`
105105
return [name, description ? dim(description) : undefined]
106106
}), {stripAnsi: this.opts.stripAnsi, maxWidth: this.opts.maxWidth - 2})
@@ -144,7 +144,7 @@ export default class CommandHelp {
144144
}
145145

146146
let right = flag.description || ''
147-
if (flag.type === 'option' && flag.default) {
147+
if (flag.type === 'option' && flag.default !== '' && flag.default !== undefined) {
148148
right = `[default: ${flag.default}] ${right}`
149149
}
150150
if (flag.required) right = `(required) ${right}`

0 commit comments

Comments
 (0)