Comparing version 1.1.0 to 1.2.0
12
app.js
'use strict' | ||
const onExit = require('signal-exit') | ||
const updateNotifier = require('update-notifier'); | ||
const yargs = require('yargs') | ||
@@ -30,3 +29,6 @@ const path = require('path') | ||
: Object.keys(pkg.bin).some(b => nameMatch.test(b) || nameMatch.test(pkg.bin[b])) | ||
if (isInPackage) updateNotifier({pkg: pkg}).notify() | ||
if (isInPackage) { | ||
const updateNotifier = require('update-notifier'); | ||
updateNotifier({pkg: pkg}).notify() | ||
} | ||
} catch (ex) { /* don't care */ } | ||
@@ -49,3 +51,7 @@ }) | ||
exited = true | ||
console.error(err && err.stack ? err.stack : err) | ||
if (typeof err === 'number') { | ||
process.exit(err) | ||
} else if (err) { | ||
console.error(err && err.stack ? err.stack : err) | ||
} | ||
process.exit(1) | ||
@@ -52,0 +58,0 @@ } |
{ | ||
"name": "@iarna/cli", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Some simple CLI scaffolding for promise returning applications.", | ||
@@ -5,0 +5,0 @@ "main": "app.js", |
@@ -14,2 +14,3 @@ # @iarna/cli | ||
.boolean('reject') | ||
.boolean('code50') | ||
.version() | ||
@@ -24,2 +25,3 @@ .help() | ||
if (opts.reject) return Promise.reject(new Error('reject')) | ||
if (opts.code50) return Promise.reject(50) | ||
return new Promise(resolve => setTimeout(resolve, 10000)) | ||
@@ -44,3 +46,2 @@ } | ||
$ node example --silent hello there world --error | ||
Abnormal exit: Promises not resolved | ||
Got: hello there world | ||
@@ -61,3 +62,6 @@ Error: throw | ||
at processImmediate [as _immediateCallback] (timers.js:733:5) | ||
$ | ||
$ node example --silent hello there world --code50 | ||
Got: hello there world | ||
$ echo $? | ||
50 | ||
``` | ||
@@ -94,6 +98,6 @@ | ||
The module itself returns a function that you need to call with the name of | ||
your main function. This is the top level function of your program that | ||
should return a promise, that when resolved indicates that your program is | ||
complete. | ||
The module itself exports a function that you need to call with the name of | ||
your main function. Your main function is like `main` in C, it's the entry | ||
point for your program. It needs to return a promise that resolves when | ||
your program completes. | ||
@@ -100,0 +104,0 @@ Your entry point function can be named anything, but it needs to return a |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57
106
6978
4