commander
Advanced tools
Comparing version 2.18.0 to 2.19.0
2.19.0 / 2018-10-02 | ||
================== | ||
* Removed newline after Options and Commands headers (#864) | ||
* Bugfix - Error output (#862) | ||
* Fix to change default value to string (#856) | ||
2.18.0 / 2018-09-07 | ||
@@ -3,0 +10,0 @@ ================== |
26
index.js
@@ -583,5 +583,5 @@ /** | ||
if (err.code === 'ENOENT') { | ||
console.error('%s(1) does not exist, try --help', bin); | ||
console.error('error: %s(1) does not exist, try --help', bin); | ||
} else if (err.code === 'EACCES') { | ||
console.error('%s(1) not executable. try chmod or run with root', bin); | ||
console.error('error: %s(1) not executable. try chmod or run with root', bin); | ||
} | ||
@@ -796,5 +796,3 @@ process.exit(1); | ||
Command.prototype.missingArgument = function(name) { | ||
console.error(); | ||
console.error(" error: missing required argument `%s'", name); | ||
console.error(); | ||
console.error("error: missing required argument `%s'", name); | ||
process.exit(1); | ||
@@ -812,9 +810,7 @@ }; | ||
Command.prototype.optionMissingArgument = function(option, flag) { | ||
console.error(); | ||
if (flag) { | ||
console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); | ||
console.error("error: option `%s' argument missing, got `%s'", option.flags, flag); | ||
} else { | ||
console.error(" error: option `%s' argument missing", option.flags); | ||
console.error("error: option `%s' argument missing", option.flags); | ||
} | ||
console.error(); | ||
process.exit(1); | ||
@@ -832,5 +828,3 @@ }; | ||
if (this._allowUnknownOption) return; | ||
console.error(); | ||
console.error(" error: unknown option `%s'", flag); | ||
console.error(); | ||
console.error("error: unknown option `%s'", flag); | ||
process.exit(1); | ||
@@ -847,5 +841,3 @@ }; | ||
Command.prototype.variadicArgNotLast = function(name) { | ||
console.error(); | ||
console.error(" error: variadic arguments must be last `%s'", name); | ||
console.error(); | ||
console.error("error: variadic arguments must be last `%s'", name); | ||
process.exit(1); | ||
@@ -1061,3 +1053,3 @@ }; | ||
return pad(option.flags, width) + ' ' + option.description + | ||
((option.bool && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : ''); | ||
((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : ''); | ||
}).concat([pad('-h, --help', width) + ' ' + 'output usage information']) | ||
@@ -1082,3 +1074,2 @@ .join('\n'); | ||
'Commands:', | ||
'', | ||
commands.map(function(cmd) { | ||
@@ -1134,3 +1125,2 @@ var desc = cmd[1] ? ' ' + cmd[1] : ''; | ||
'Options:', | ||
'', | ||
'' + this.optionHelp().replace(/^/gm, ' '), | ||
@@ -1137,0 +1127,0 @@ '' |
{ | ||
"name": "commander", | ||
"version": "2.18.0", | ||
"version": "2.19.0", | ||
"description": "the complete solution for node.js command-line programs", | ||
@@ -29,6 +29,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/node": "^10.9.4", | ||
"eslint": "^5.5.0", | ||
"@types/node": "^10.11.3", | ||
"eslint": "^5.6.1", | ||
"should": "^13.2.3", | ||
"sinon": "^6.2.0", | ||
"sinon": "^6.3.4", | ||
"standard": "^12.0.1", | ||
@@ -35,0 +35,0 @@ "ts-node": "^7.0.1", |
@@ -257,3 +257,2 @@ # Commander.js | ||
Options: | ||
-h, --help output usage information | ||
@@ -298,3 +297,2 @@ -V, --version output the version number | ||
console.log('Examples:'); | ||
console.log(''); | ||
console.log(' $ custom-help --help'); | ||
@@ -315,3 +313,2 @@ console.log(' $ custom-help -h'); | ||
Options: | ||
-h, --help output usage information | ||
@@ -324,3 +321,2 @@ -V, --version output the version number | ||
Examples: | ||
$ custom-help --help | ||
@@ -327,0 +323,0 @@ $ custom-help -h |
61383
1338
418