Skip to content

Commit

Permalink
fix(chore): warn appropriately on supplying invalid flags (#380)
Browse files Browse the repository at this point in the history
* fix: warn appropriately on supplying invalid flags

* fix: minor tweak

* fix: indent

* chore: fix lint error
  • Loading branch information
jamesgeorge007 authored and Eunjae Lee committed Nov 2, 2019
1 parent ecd2c1c commit bff3a3b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/shipjs/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ export async function cli(argv) {
printHelp();
return;
}
const opts = removeDoubleDash(
parseArgs(argSpec, { permissive: false, argv })
);
await fn(opts);
try {
const opts = removeDoubleDash(
parseArgs(argSpec, { permissive: false, argv })
);
await fn(opts);
} catch (error) {
if (error.code === 'ARG_UNKNOWN_OPTION') {
print(error);
} else {
throw error;
}
}
}

0 comments on commit bff3a3b

Please sign in to comment.