diff --git a/src/command.ts b/src/command.ts index cbfd0a2b..4aa47ef2 100644 --- a/src/command.ts +++ b/src/command.ts @@ -100,7 +100,8 @@ 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}` + // `a.default` is actually not always a string (typing bug), hence `toString()` + if (a.default || a.default?.toString() === '0') 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}) @@ -144,7 +145,8 @@ export default class CommandHelp { } let right = flag.description || '' - if (flag.type === 'option' && flag.default) { + // `flag.default` is not always a string (typing bug), hence `toString()` + if (flag.type === 'option' && (flag.default || flag.default?.toString() === '0')) { right = `[default: ${flag.default}] ${right}` } if (flag.required) right = `(required) ${right}`