Skip to content

Commit

Permalink
Clarify that default option values are persistent
Browse files Browse the repository at this point in the history
  • Loading branch information
aweebit committed Jul 29, 2023
1 parent ebf672a commit 7fd0b22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/command.js
Expand Up @@ -532,10 +532,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
// --no-foo is special and defaults foo to true, unless a --foo option is already defined
const positiveLongFlag = option.long.replace(/^--no-/, '--');
if (!this._findOption(positiveLongFlag)) {
this.setOptionValueWithSource(name, option.defaultValue === undefined ? true : option.defaultValue, 'default');
this._setPersistentOptionValueWithSource(name, option.defaultValue === undefined ? true : option.defaultValue, 'default');
}
} else if (option.defaultValue !== undefined) {
this.setOptionValueWithSource(name, option.defaultValue, 'default');
this._setPersistentOptionValueWithSource(name, option.defaultValue, 'default');
}

// register the option
Expand Down

0 comments on commit 7fd0b22

Please sign in to comment.