Skip to content

Commit

Permalink
2351 CLI sets exit-code 1 if the command supplied was not parseable (#…
Browse files Browse the repository at this point in the history
…2358)

* CLI Sets exit code to 1 if the command wasn't parseable

* Fix color output for errors in the cli
  • Loading branch information
P-Seebauer authored and elhigu committed Jan 18, 2018
1 parent 9f8d2ed commit 15706c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ var cliPkg = require('../package');

function exit(text) {
if (text instanceof Error) {
chalk.red(console.error(text.stack));
console.error(chalk.red(text.stack));
} else {
chalk.red(console.error(text));
console.error(chalk.red(text));
}
process.exit(1);
}
Expand Down Expand Up @@ -186,7 +186,8 @@ function invoke(env) {
commander.parse(process.argv);

Promise.resolve(pending).then(function() {
commander.help();
commander.outputHelp();
exit('Unknown command-line options, exiting');
});
}

Expand Down

0 comments on commit 15706c0

Please sign in to comment.