Skip to content

Commit

Permalink
exit with exit code 1 on invalid input
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 25, 2015
1 parent 15d5d8a commit 9de71bb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,23 @@ function parse(args, globalOptions) {
function init(args, options) {
if (options.version) {
console.log(pkg.version);
return;
process.exit();
}

if (options.help || !args.length) {
if (options.help) {
showHelp();
return;
process.exit();
}

if (args.length === 0) {
showHelp();
process.exit(1);
}

var nonGroupedArgs = args.filter(function (arg) {
return !arg._;
});

// filter grouped args
args = args.filter(function (arg) {
return arg._;
Expand Down

0 comments on commit 9de71bb

Please sign in to comment.