command-line-tool
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -42,6 +42,8 @@ 'use strict' | ||
* @param [options] {object} | ||
* @param [options.stack] {boolean} - defaults to false | ||
*/ | ||
printError (err) { | ||
/* detect whether operational or programmer error, and display stack if latter */ | ||
console.error(ansi.format(t.isString(err) ? err : err.stack, 'red')) | ||
printError (err, options) { | ||
options = options || {} | ||
const msg = t.isString(err) ? err : options.stack ? err.stack : err.message | ||
console.error(ansi.format(msg, 'red')) | ||
} | ||
@@ -55,2 +57,3 @@ | ||
* @param [options.exitCode] {number} - defaults to 1 | ||
* @param [options.stack] {boolean} - defaults to false | ||
*/ | ||
@@ -63,3 +66,3 @@ halt (err, options) { | ||
} else { | ||
this.printError(err) | ||
this.printError(err, options) | ||
} | ||
@@ -75,10 +78,2 @@ } | ||
definitions = arrayify(definitions) | ||
if (!definitions.some(where({ name: 'help' }))) { | ||
definitions.push({ | ||
name: 'help', | ||
alias: 'h', | ||
type: Boolean, | ||
description: 'Print usage information.' | ||
}) | ||
} | ||
const commandLineArgs = require('command-line-args') | ||
@@ -96,5 +91,2 @@ const commandLineUsage = require('command-line-usage') | ||
} | ||
if (options.help || (options._all && options._all.help)) { | ||
this.stop(this.usage) | ||
} | ||
return options | ||
@@ -101,0 +93,0 @@ } |
{ | ||
"name": "command-line-tool", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "command-line-tool", | ||
@@ -22,3 +22,3 @@ "repository": "https://github.com/75lb/command-line-tool.git", | ||
"command-line-args": "^3.0.0", | ||
"command-line-usage": "^3.0.1", | ||
"command-line-usage": "^3.0.3", | ||
"test-value": "^2.0.0", | ||
@@ -30,3 +30,3 @@ "typical": "^2.4.2" | ||
"jsdoc-to-markdown": "^1.3.6", | ||
"tape": "^4.5.1" | ||
"tape": "^4.6.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "standard": { |
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
9659
158
Updatedcommand-line-usage@^3.0.3