diff --git a/lib/command.js b/lib/command.js index a176dfbb9..f1cdc429f 100644 --- a/lib/command.js +++ b/lib/command.js @@ -1756,7 +1756,7 @@ Expecting one of '${allowedValues.join("', '")}'`); const negativeNumberArg = (arg) => { // return false if not a negative number - if (!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(arg)) return false; + if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false; // negative number is ok unless digit used as an option in command hierarchy return !this._getCommandAndAncestors().some((cmd) => cmd.options