Skip to content

Commit

Permalink
fix: add respectNoCacheDefault to help options
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 2, 2024
1 parent 95ee77f commit 7320fff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/help/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
}

Expand Down
4 changes: 4 additions & 0 deletions src/interfaces/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 7320fff

Please sign in to comment.