From 6a32bbc3acc9c41068234d80188e9d2e865f50fa Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Mon, 5 Sep 2016 16:20:03 +0700 Subject: [PATCH] use exit code 2 when manually calling `cli.showHelp()` closes #47 --- index.js | 4 ++-- readme.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index b45e849..53213a2 100644 --- a/index.js +++ b/index.js @@ -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) { @@ -67,7 +67,7 @@ module.exports = (opts, minimistOpts) => { } if (argv.help && opts.help !== false) { - showHelp(); + showHelp(0); } const input = argv._; diff --git a/readme.md b/readme.md index 2b368dc..3999bdc 100644 --- a/readme.md +++ b/readme.md @@ -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