From 7fd0b22f1adc75a97bdb4af262a71126cb9f3b8f Mon Sep 17 00:00:00 2001 From: aweebit <36817090+aweebit@users.noreply.github.com> Date: Sat, 29 Jul 2023 09:37:37 +0300 Subject: [PATCH] Clarify that default option values are persistent --- lib/command.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/command.js b/lib/command.js index af4d6eb1d..e1f7a4e99 100644 --- a/lib/command.js +++ b/lib/command.js @@ -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