Comparing version 1.8.1 to 1.8.2-67-fix-ignored-error-in-async-action-functions-071074f58e7ce369ba85f38f6c6188540f039f79
@@ -5,4 +5,2 @@ var Command, Option, Signature, _, parse, settings, state, utils; | ||
_.str = require('underscore.string'); | ||
parse = require('./parse'); | ||
@@ -35,3 +33,7 @@ | ||
this.options = []; | ||
_.each(options.options, this.option, this); | ||
_.forEach(options.options, (function(_this) { | ||
return function(option) { | ||
return _this.option(option); | ||
}; | ||
})(this)); | ||
_.extend(this, _.omit(options, 'options')); | ||
@@ -93,2 +95,3 @@ } | ||
return _this.applyPermissions(function(error) { | ||
var actionPromise; | ||
if (error != null) { | ||
@@ -98,3 +101,3 @@ return typeof callback === "function" ? callback(error) : void 0; | ||
try { | ||
_this.action(params, parsedOptions, callback); | ||
actionPromise = _this.action(params, parsedOptions, callback); | ||
} catch (error1) { | ||
@@ -104,4 +107,18 @@ error = error1; | ||
} | ||
if (_this.action.length < 3) { | ||
return typeof callback === "function" ? callback() : void 0; | ||
if (callback != null) { | ||
if ((actionPromise != null ? actionPromise.then : void 0) != null) { | ||
return actionPromise.then(function(_value) { | ||
if (_this.action.length < 3) { | ||
return callback(); | ||
} | ||
}, function(_error) { | ||
if (_error) { | ||
return callback(_error); | ||
} | ||
}); | ||
} else { | ||
if (_this.action.length < 3) { | ||
return callback(); | ||
} | ||
} | ||
} | ||
@@ -108,0 +125,0 @@ }); |
@@ -58,3 +58,3 @@ var Option, Signature, _, isValidAlias, parse; | ||
} | ||
return !_.any([this.boolean && !_.isBoolean(value), !this.boolean && _.isBoolean(value)]); | ||
return !_.some([this.boolean && !_.isBoolean(value), !this.boolean && _.isBoolean(value)]); | ||
}; | ||
@@ -61,0 +61,0 @@ |
@@ -52,3 +52,3 @@ var Parameter, REGEX_MULTIWORD, REGEX_OPTIONAL, REGEX_REQUIRED, REGEX_STDIN, REGEX_VARIADIC, STDIN_CHARACTER, _, parse; | ||
Parameter.prototype.isWord = function() { | ||
return !_.any([this.isRequired(), this.isOptional()]); | ||
return !_.some([this.isRequired(), this.isOptional()]); | ||
}; | ||
@@ -55,0 +55,0 @@ |
@@ -5,4 +5,2 @@ var Parameter, Signature, _, appearedMoreThanOnce, async, isLastOne, parse, settings, utils; | ||
_.str = require('underscore.string'); | ||
async = require('async'); | ||
@@ -37,3 +35,7 @@ | ||
this.parameters = []; | ||
_.each(parse.split(signature), this._addParameter, this); | ||
_.forEach(parse.split(signature), (function(_this) { | ||
return function(word) { | ||
return _this._addParameter(word); | ||
}; | ||
})(this)); | ||
if (this.allowsStdin()) { | ||
@@ -70,3 +72,3 @@ isStdin = function(parameter) { | ||
Signature.prototype.hasParameters = function() { | ||
return _.any(this.parameters, function(parameter) { | ||
return _.some(this.parameters, function(parameter) { | ||
return !parameter.isWord(); | ||
@@ -77,3 +79,3 @@ }); | ||
Signature.prototype.hasVariadicParameters = function() { | ||
return _.any(this.parameters, function(parameter) { | ||
return _.some(this.parameters, function(parameter) { | ||
return parameter.isVariadic(); | ||
@@ -84,3 +86,3 @@ }); | ||
Signature.prototype.allowsStdin = function() { | ||
return _.any(this.parameters, function(parameter) { | ||
return _.some(this.parameters, function(parameter) { | ||
return parameter.allowsStdin(); | ||
@@ -102,3 +104,3 @@ }); | ||
Signature.prototype.isWildcard = function() { | ||
return _.all([this.parameters.length === 1, this.parameters[0].toString() === settings.signatures.wildcard]); | ||
return _.every([this.parameters.length === 1, this.parameters[0].toString() === settings.signatures.wildcard]); | ||
}; | ||
@@ -111,3 +113,3 @@ | ||
} | ||
if (_.str.startsWith(error.message, 'Missing')) { | ||
if (_.startsWith(error.message, 'Missing')) { | ||
return callback(true); | ||
@@ -114,0 +116,0 @@ } |
@@ -7,2 +7,7 @@ # Change Log | ||
## 1.8.2 - 2018-11-12 | ||
* Fix ignored error in async action functions [Paulo Castro] | ||
* Dependencies: Update lodash and underscore.string packages [Lucian Buzzo] | ||
## v1.8.1 - 2018-08-28 | ||
@@ -9,0 +14,0 @@ |
{ | ||
"name": "capitano", | ||
"version": "1.8.1", | ||
"version": "1.8.2-67-fix-ignored-error-in-async-action-functions-071074f58e7ce369ba85f38f6c6188540f039f79", | ||
"description": "Powerful, non opitionated command line parser for serious applications", | ||
@@ -29,2 +29,3 @@ "main": "build/capitano.js", | ||
"devDependencies": { | ||
"bluebird": "^3.3.3", | ||
"chai": "~2.3.0", | ||
@@ -45,6 +46,6 @@ "coffee-script": "~1.9.2", | ||
"is-elevated": "^1.0.0", | ||
"lodash": "~3.9.1", | ||
"underscore.string": "~3.0.3", | ||
"lodash": "~4.17.10", | ||
"underscore.string": "~3.3.4", | ||
"yargs-parser": "^2.4.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
156095
800
11
1
+ Addedlodash@4.17.21(transitive)
+ Addedsprintf-js@1.1.3(transitive)
+ Addedunderscore.string@3.3.6(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedlodash@3.9.3(transitive)
- Removedunderscore.string@3.0.3(transitive)
Updatedlodash@~4.17.10
Updatedunderscore.string@~3.3.4