Skip to content

Commit 0736ae3

Browse files
jamesgeorge007sendilkumarn
authored andcommitted
chore: handle unknown flags (#157)
* fix: tweak closes #156 * fix: prevent crash
1 parent 67db6a1 commit 0736ae3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.bin/create-rust-webpack.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,18 @@ if (!isPresent("git --version")) {
3232
process.exit(1);
3333
}
3434

35+
const args = process.argv.slice(2);
36+
37+
if (args.some(arg => arg.includes('-'))) {
38+
console.log(`Error: unknown option ${args.filter(arg => arg.includes('-'))}`);
39+
process.exit(1);
40+
}
41+
3542
let folderName = '.';
3643

37-
if (process.argv.length >= 3) {
38-
folderName = process.argv[2];
44+
if (args.length >= 1) {
45+
folderName = args[0];
46+
3947
if (!fs.existsSync(folderName)) {
4048
fs.mkdirSync(folderName);
4149
}

0 commit comments

Comments
 (0)