diff --git a/src/help/command.ts b/src/help/command.ts index 239e3b95..951bf3b1 100644 --- a/src/help/command.ts +++ b/src/help/command.ts @@ -188,7 +188,8 @@ export class CommandHelp extends HelpFormatter { if (noChar) left = left.replace(' ', '') let right = flag.summary || flag.description || '' - if (flag.type === 'option' && flag.default) { + const canBeCached = !(this.opts.respectNoCacheDefault === true && flag.noCacheDefault === true) + if (flag.type === 'option' && flag.default && canBeCached) { right = `${colorize(this.config?.theme?.flagDefaultValue, `[default: ${flag.default}]`)} ${right}` } diff --git a/src/interfaces/help.ts b/src/interfaces/help.ts index 370dac77..33709b4b 100644 --- a/src/interfaces/help.ts +++ b/src/interfaces/help.ts @@ -24,6 +24,10 @@ export interface HelpOptions { */ hideCommandSummaryInDescription?: boolean maxWidth: number + /** + * Respect the `noCacheDefault` property on flags. Defaults to false. + */ + respectNoCacheDefault?: boolean /** * Only show the help for the specified sections. Defaults to all sections. */