mirror of
https://github.com/expo/oclif-plugin-help.git
synced 2026-11-14 19:11:14 -10:00
fix: render default arg/opt if equal to 0 (#264)
This commit is contained in:
1 parent
095b4b4950
commit
ca0af1908a
1 file changed
+4
-2
+4
-2
@@ -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}`
|
||||
|
||||
Reference in new issue
Block a user