Skip to content

Commit

Permalink
chore: handle unknown flags (#157)
Browse files Browse the repository at this point in the history
* fix: tweak

closes #156

* fix: prevent crash
  • Loading branch information
jamesgeorge007 authored and sendilkumarn committed Nov 5, 2019
1 parent 67db6a1 commit 0736ae3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .bin/create-rust-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@ if (!isPresent("git --version")) {
process.exit(1);
}

const args = process.argv.slice(2);

if (args.some(arg => arg.includes('-'))) {
console.log(`Error: unknown option ${args.filter(arg => arg.includes('-'))}`);
process.exit(1);
}

let folderName = '.';

if (process.argv.length >= 3) {
folderName = process.argv[2];
if (args.length >= 1) {
folderName = args[0];

if (!fs.existsSync(folderName)) {
fs.mkdirSync(folderName);
}
Expand Down

0 comments on commit 0736ae3

Please sign in to comment.