diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 22810fcdbe..132da7c9b4 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -28,7 +28,6 @@ "easy-table": "^1.2.0", "jmespath": "^0.16.0", "json-to-ast": "^2.1.0", - "minimist": "^1.2.8", "node-forge": "^1.3.1", "omelette": "^0.4.17", "open": "^10.1.0", diff --git a/package.json b/package.json index 7270284aaf..7f28a89ce6 100644 --- a/package.json +++ b/package.json @@ -271,7 +271,6 @@ "easy-table": "^1.2.0", "jmespath": "^0.16.0", "json-to-ast": "^2.1.0", - "minimist": "^1.2.8", "node-forge": "^1.3.1", "omelette": "^0.4.17", "open": "^10.1.0", diff --git a/src/cli/cli.spec.ts b/src/cli/cli.spec.ts index 2e0273848e..cd3d198d15 100644 --- a/src/cli/cli.spec.ts +++ b/src/cli/cli.spec.ts @@ -1859,4 +1859,17 @@ describe('cli', () => { await cli.execute(['cli', 'completion', 'sh', 'update']); assert(loadAllCommandsInfoStub.calledWith(true)); }); + + it('validates if yargs parser has correct configuration', async () => { + const yargsConfiguration = cli.yargsConfiguration; + + assert.deepStrictEqual(yargsConfiguration, { + 'parse-numbers': true, + 'strip-aliased': true, + 'strip-dashed': true, + 'dot-notation': false, + 'boolean-negation': true, + 'camel-case-expansion': false + }); + }); }); \ No newline at end of file diff --git a/src/cli/cli.ts b/src/cli/cli.ts index 9849e126c5..67cb4c581d 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -48,6 +48,14 @@ const defaultHelpMode = 'options'; const defaultHelpTarget = 'console'; const helpModes: string[] = ['options', 'examples', 'remarks', 'response', 'full']; const helpTargets: string[] = ['console', 'web']; +const yargsConfiguration: Partial = { + 'parse-numbers': true, + 'strip-aliased': true, + 'strip-dashed': true, + 'dot-notation': false, + 'boolean-negation': true, + 'camel-case-expansion': false +}; function getConfig(): Configstore { if (!_config) { @@ -166,7 +174,7 @@ async function execute(rawArgs: string[]): Promise { if (!result.success) { return cli.closeWithError(result.error, cli.optionsFromArgs, true); } - + finalArgs = result.data; } else { @@ -477,11 +485,7 @@ function getCommandOptions(command: Command): CommandOptionInfo[] { function getCommandOptionsFromArgs(args: string[], commandInfo: CommandInfo | undefined): yargs.Arguments { const yargsOptions: yargs.Options = { alias: {}, - configuration: { - "parse-numbers": false, - "strip-aliased": true, - "strip-dashed": true - } + configuration: yargsConfiguration }; let argsToParse = args; @@ -1015,5 +1019,6 @@ export const cli = { printAvailableCommands, promptForConfirmation, promptForSelection, - shouldTrimOutput + shouldTrimOutput, + yargsConfiguration }; \ No newline at end of file