Skip to content

Commit

Permalink
fix: reinstate Gradle subproject arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Yegupov committed Aug 13, 2019
1 parent 28e44ae commit 30a2c86
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion help/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Options:
of the vulnerable paths.

Gradle options:
--gradle-sub-project=<string>
--sub-project=<string> (alias: --gradle-sub-project)
For Gradle "multi project" configurations,
test a specific sub-project.
--all-sub-projects For "multi project" configurations, test all
Expand Down
9 changes: 9 additions & 0 deletions src/cli/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ export function args(rawArgv: string[]): Args {
'packages-folder',
'severity-threshold',
'strict-out-of-sync',
'all-sub-projects',
'sub-project',
'gradle-sub-project',
]) {
if (argv[dashedArg]) {
const camelCased = dashToCamelCase(dashedArg);
Expand All @@ -168,6 +171,12 @@ export function args(rawArgv: string[]): Args {
}
}

// Alias
if (argv.gradleSubProject) {
argv.subProject = argv.gradleSubProject;
delete argv.gradleSubProject;
}

if (argv.insecure) {
global.ignoreUnknownCA = true;
}
Expand Down
27 changes: 26 additions & 1 deletion test/args.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,31 @@ test('test --insecure', function(t) {
'--insecure',
];
var result = args(cliArgs);
t.equal(global.ignoreUnknownCA, true, 'ignoreUnknownCA true');
t.equal(global.ignoreUnknownCA, true, 'ignoreUnknownCA true')
t.end();
});


test('test command line test --all-sub-projects', function(t) {
t.plan(1);
var cliArgs = [ '/Users/dror/.nvm/versions/node/v6.9.2/bin/node',
'/Users/dror/work/snyk/snyk-internal/cli',
'test',
'--all-sub-projects',
];
var result = args(cliArgs);
t.ok(result.options.allSubProjects);
t.end();
});

test('test command line test --gradle-sub-project=foo', function(t) {
t.plan(1);
var cliArgs = [ '/Users/dror/.nvm/versions/node/v6.9.2/bin/node',
'/Users/dror/work/snyk/snyk-internal/cli',
'test',
'--gradle-sub-project=foo',
];
var result = args(cliArgs);
t.equal(result.options.subProject, 'foo');
t.end();
});

0 comments on commit 30a2c86

Please sign in to comment.