Skip to content

Commit

Permalink
fix: nuget-plugin 1.2.0 + cli arguments transfer to camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
eavichay committed Nov 12, 2017
1 parent fab007b commit c2e0750
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions cli/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ var alias = abbrev('copy', 'version', 'debug', 'help', 'quiet', 'interactive',
alias.d = 'debug'; // always make `-d` debug
alias.t = 'test';

function dashToCamelCase(dash) {
return dash.indexOf('-') < 0
? dash
: dash.replace(/-[a-z]/g, function (m) {return m[1].toUpperCase()})
}

function args(processargv) {
// all arguments after a '--' are taken as is and passed to the next process
// (see the snyk-mvn-plugin or snyk-gradle-plugin)
Expand Down Expand Up @@ -113,10 +119,18 @@ function args(processargv) {
argv._.push(argv);
}

if (argv['package-manager']) {
argv.packageManager = argv['package-manager'];
delete argv['package-manager'];
}
// arguments that needs transformation from dash-case to camelCase
// should be added here
[
'package-manager',
'packages-folder',
].forEach(function (dashedArg) {
if (argv[dashedArg]) {
var camelCased = dashToCamelCase(dashedArg);
argv[camelCased] = argv[dashedArg];
delete argv[dashedArg];
}
});

debug(command, argv);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"snyk-gradle-plugin": "1.2.0",
"snyk-module": "1.8.1",
"snyk-mvn-plugin": "1.1.0",
"snyk-nuget-plugin": "1.1.1",
"snyk-nuget-plugin": "1.2.0",
"snyk-policy": "1.7.1",
"snyk-python-plugin": "1.4.0",
"snyk-recursive-readdir": "^2.0.0",
Expand Down

0 comments on commit c2e0750

Please sign in to comment.