Skip to content

Commit

Permalink
Merge pull request #1212 from oclif/mdonnalley/respect-no-cache-defau…
Browse files Browse the repository at this point in the history
…lt-help

fix: add respectNoCacheDefault to help options
  • Loading branch information
WillieRuemmele authored Oct 3, 2024
2 parents 9ccba39 + 7320fff commit f335853
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 f335853

Please sign in to comment.