Skip to content

Commit

Permalink
use exit code 2 when manually calling cli.showHelp()
Browse files Browse the repository at this point in the history
closes #47
  • Loading branch information
sindresorhus committed Sep 5, 2016
1 parent 2d4d890 commit 6a32bbc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -58,7 +58,7 @@ module.exports = (opts, minimistOpts) => {

const showHelp = code => {
console.log(help);
process.exit(code || 0);
process.exit(typeof code === 'number' ? code : 2);
};

if (argv.version && opts.version !== false) {
Expand All @@ -67,7 +67,7 @@ module.exports = (opts, minimistOpts) => {
}

if (argv.help && opts.help !== false) {
showHelp();
showHelp(0);
}

const input = argv._;
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -71,7 +71,7 @@ Returns an `Object` with:
- `flags` *(Object)* - Flags converted to camelCase
- `pkg` *(Object)* - The `package.json` object
- `help` *(string)* - The help text used with `--help`
- `showHelp([code=0])` *(Function)* - Show the help text and exit with `code`
- `showHelp([code=2])` *(Function)* - Show the help text and exit with `code`

#### options

Expand Down

0 comments on commit 6a32bbc

Please sign in to comment.