From de12d11c47a50b24b56dc654fefd465baaca49d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20W=C3=B3dkiewicz?= Date: Sat, 10 Jul 2021 03:28:52 +0200 Subject: [PATCH] fix: render default arg/opt if equal to 0 --- src/command.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command.ts b/src/command.ts index cbfd0a2b..15abd9cd 100644 --- a/src/command.ts +++ b/src/command.ts @@ -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}) @@ -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}`