Comparing version 15.4.1 to 15.5.0-candidate.0
@@ -26,3 +26,3 @@ import { Dictionary } from './common-types'; | ||
unfreeze(): void; | ||
unknownArguments(argv: Arguments, aliases: DetailedArguments['aliases'], positionalMap: Dictionary, isDefaultCommand: boolean): void; | ||
unknownArguments(argv: Arguments, aliases: DetailedArguments['aliases'], positionalMap: Dictionary, isDefaultCommand: boolean, checkPositionals?: boolean): void; | ||
unknownCommands(argv: Arguments): boolean; | ||
@@ -29,0 +29,0 @@ } |
@@ -78,3 +78,3 @@ "use strict"; | ||
// check for unknown arguments (strict-mode). | ||
self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand) { | ||
self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) { | ||
const commandKeys = yargs.getCommandInstance().getCommands(); | ||
@@ -91,3 +91,3 @@ const unknown = []; | ||
}); | ||
if ((currentContext.commands.length > 0) || (commandKeys.length > 0) || isDefaultCommand) { | ||
if (checkPositionals && ((currentContext.commands.length > 0) || (commandKeys.length > 0) || isDefaultCommand)) { | ||
argv._.slice(currentContext.commands.length).forEach((key) => { | ||
@@ -94,0 +94,0 @@ if (commandKeys.indexOf(key) === -1) { |
@@ -117,2 +117,3 @@ /// <reference types="node" /> | ||
getStrictCommands(): boolean; | ||
getStrictOptions(): boolean; | ||
getUsageInstance(): UsageInstance; | ||
@@ -171,2 +172,3 @@ getValidationInstance(): ValidationInstance; | ||
strictCommands(enable?: boolean): YargsInstance; | ||
strictOptions(enable?: boolean): YargsInstance; | ||
string(key: string | string[]): YargsInstance; | ||
@@ -173,0 +175,0 @@ terminalWidth(): number | null; |
@@ -141,2 +141,3 @@ "use strict"; | ||
strictCommands, | ||
strictOptions, | ||
completionCommand, | ||
@@ -170,2 +171,3 @@ output, | ||
strictCommands, | ||
strictOptions, | ||
completionCommand, | ||
@@ -777,2 +779,9 @@ parseFn, | ||
self.getStrictCommands = () => strictCommands; | ||
let strictOptions = false; | ||
self.strictOptions = function (enabled) { | ||
argsert_1.argsert('[boolean]', [enabled], arguments.length); | ||
strictOptions = enabled !== false; | ||
return self; | ||
}; | ||
self.getStrictOptions = () => strictOptions; | ||
let parserConfig = {}; | ||
@@ -1166,2 +1175,5 @@ self.parserConfiguration = function parserConfiguration(config) { | ||
} | ||
else if (strictOptions) { | ||
validation.unknownArguments(argv, aliases, {}, false, false); | ||
} | ||
validation.customChecks(argv, aliases); | ||
@@ -1168,0 +1180,0 @@ validation.limitedChoices(argv); |
{ | ||
"name": "yargs", | ||
"version": "15.4.1", | ||
"version": "15.5.0-candidate.0", | ||
"description": "yargs the modern, pirate-themed, successor to optimist.", | ||
@@ -39,3 +39,3 @@ "main": "./index.js", | ||
"@typescript-eslint/parser": "^3.0.0", | ||
"c8": "^7.0.0", | ||
"c8": "^6.0.1", | ||
"chai": "^4.2.0", | ||
@@ -42,0 +42,0 @@ "chalk": "^4.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
231172
4710
1