Skip to content

Commit

Permalink
fix: render default arg/opt if equal to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
akwodkiewicz committed Jul 10, 2021
1 parent 095b4b4 commit de12d11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default class CommandHelp {
const body = renderList(args.map(a => {
const name = a.name.toUpperCase()
let description = a.description || ''
if (a.default) description = `[default: ${a.default}] ${description}`
if (a.default !== '' && a.default !== undefined) description = `[default: ${a.default}] ${description}`
if (a.options) description = `(${a.options.join('|')}) ${description}`
return [name, description ? dim(description) : undefined]
}), {stripAnsi: this.opts.stripAnsi, maxWidth: this.opts.maxWidth - 2})
Expand Down Expand Up @@ -144,7 +144,7 @@ export default class CommandHelp {
}

let right = flag.description || ''
if (flag.type === 'option' && flag.default) {
if (flag.type === 'option' && flag.default !== '' && flag.default !== undefined) {
right = `[default: ${flag.default}] ${right}`
}
if (flag.required) right = `(required) ${right}`
Expand Down

0 comments on commit de12d11

Please sign in to comment.