Skip to content

Commit cf1aa73

Browse files
authored
feat: change default command to help (#497)
1 parent c3c44aa commit cf1aa73

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

bin/main.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ async function main(isProduction = false) {
77
strict: false, // Don't validate flags
88
});
99

10-
// If no arguments at all, default to scan:eol
10+
// If no arguments at all, default to help
1111
if (positionals.length === 0) {
12-
process.argv.splice(2, 0, 'scan:eol');
13-
}
14-
// If only flags are provided, set scan:eol as the command for those flags
15-
else if (positionals.length === 1 && positionals[0].startsWith('-')) {
16-
process.argv.splice(2, 0, 'scan:eol');
12+
process.argv.splice(2, 0, 'help');
1713
}
1814

1915
try {

e2e/scan/eol.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ describe('scan:eol e2e', () => {
9292
});
9393

9494
describe('default arguments', () => {
95+
it('runs help as default command', async () => {
96+
const { stdout } = await execAsync('node bin/run.js');
97+
match(stdout, /VERSION/, 'Should show version section');
98+
match(stdout, /USAGE/, 'Should show usage section');
99+
match(stdout, /TOPICS/, 'Should show topics section');
100+
match(stdout, /COMMANDS/, 'Should show commands section');
101+
});
95102
it('runs scan:eol with file flag and shows results', async () => {
96103
const { stdout } = await run(`scan:eol --file ${simpleSbom}`);
97104
match(stdout, /Scan results:/, 'Should show results header');
@@ -106,7 +113,7 @@ describe('scan:eol e2e', () => {
106113
});
107114

108115
it('shows help for scan:eol when --help is passed in', async () => {
109-
const { stdout } = await execAsync('node bin/run.js --help');
116+
const { stdout } = await execAsync('node bin/run.js scan:eol --help');
110117
match(stdout, /USAGE/, 'Should show usage section');
111118
match(stdout, /FLAGS/, 'Should show flags section');
112119
match(stdout, /EXAMPLES/, 'Should show examples section');

0 commit comments

Comments
 (0)