Comparing version 1.1.3 to 1.2.0
@@ -0,1 +1,5 @@ | ||
## 1.2.0 (June 13, 2017) | ||
- Improved multi value option processing (@smelukov, #7) | ||
## 1.1.3 (March 16, 2017) | ||
@@ -2,0 +6,0 @@ |
30
index.js
@@ -303,2 +303,5 @@ var MAX_LINE_WIDTH = process.stdout.columns || 200; | ||
throw new SyntaxError('Option ' + token + ' should be used with at least ' + option.minArgsCount + ' argument(s)\nUsage: ' + option.usage); | ||
if (option.maxArgsCount == 1) | ||
params = params[0]; | ||
} | ||
@@ -593,5 +596,4 @@ else | ||
var option = this.options[name]; | ||
var newValue = Array.isArray(value) | ||
? option.normalize.apply(this, value) | ||
: option.normalize.call(this, value); | ||
var oldValue = this.values[name]; | ||
var newValue = option.normalize.call(this, value, oldValue); | ||
@@ -724,9 +726,6 @@ this.values[name] = option.maxArgsCount ? newValue : value; | ||
// apply beforeInit options | ||
command.setOptions( | ||
item.options.reduce(function(res, entry){ | ||
if (entry.option.beforeInit) | ||
res[entry.option.camelName] = entry.value; | ||
return res; | ||
}, {}) | ||
); | ||
item.options.forEach(function(entry){ | ||
if (entry.option.beforeInit) | ||
command.setOption(entry.option.camelName, entry.value); | ||
}); | ||
@@ -739,9 +738,6 @@ command.init_(item.args); | ||
// apply regular options | ||
command.setOptions( | ||
item.options.reduce(function(res, entry){ | ||
if (!entry.option.beforeInit) | ||
res[entry.option.camelName] = entry.value; | ||
return res; | ||
}, {}) | ||
); | ||
item.options.forEach(function(entry){ | ||
if (!entry.option.beforeInit) | ||
command.setOption(entry.option.camelName, entry.value); | ||
}); | ||
@@ -748,0 +744,0 @@ prevCommand = command; |
@@ -7,3 +7,3 @@ { | ||
"license": "MIT", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"keywords": [ | ||
@@ -10,0 +10,0 @@ "cli", |
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
24899
767