Comparing version 3.6.0 to 3.7.0
## Change Log | ||
### v3.7.0 (2015/04/04 02:29 -07:00) | ||
* [56cbe2d](https://github.com/bcoe/yargs/commit/56cbe2ddd33dc176dcbf97ba40559864a9f114e4) make .requiresArg() work with type hints. (@bcoe). | ||
* [2f5d562](https://github.com/bcoe/yargs/commit/2f5d5624f736741deeedf6a664d57bc4d857bdd0) serialize arrays and objects in usage strings. (@bcoe). | ||
* [5126304](https://github.com/bcoe/yargs/commit/5126304dd18351fc28f10530616fdd9361e0af98) be more lenient about alias/primary key ordering in chaining API. (@bcoe) | ||
### v3.6.0 (2015/03/21 01:00 +00:00) | ||
@@ -4,0 +10,0 @@ - [4e24e22](https://github.com/bcoe/yargs/commit/4e24e22e6a195e55ab943ede704a0231ac33b99c) support for .js configuration files. (@pirxpilot) |
@@ -173,3 +173,3 @@ var assert = require('assert'), | ||
else if (msg === true || typeof msg === 'undefined') { | ||
demanded[keys] = { msg: null }; | ||
demanded[keys] = { msg: undefined }; | ||
} | ||
@@ -225,2 +225,3 @@ } | ||
self.describe = function (key, desc) { | ||
options.key[key] = true; | ||
usage.describe(key, desc); | ||
@@ -227,0 +228,0 @@ return self; |
@@ -50,7 +50,2 @@ // fancy-pants parsing of argv, originally forked | ||
aliases[key] = aliases[key] || []; | ||
// don't allow the same key to be added multiple times. | ||
if (aliases[key].indexOf(c) === -1) { | ||
aliases[key] = (aliases[key] || []).concat(c); | ||
newAliases[c] = true; | ||
} | ||
} | ||
@@ -57,0 +52,0 @@ (aliases[key] || []).forEach(function (alias) { |
@@ -96,2 +96,4 @@ // this file handles outputting usage instructions, | ||
self.help = function () { | ||
normalizeAliases(); | ||
var demanded = yargs.getDemanded(), | ||
@@ -160,6 +162,7 @@ options = yargs.getOptions(), | ||
if (options.boolean[key]) type = '[boolean]'; | ||
if (options.count[key]) type = '[count]'; | ||
if (options.string[key]) type = '[string]'; | ||
if (options.normalize[key]) type = '[string]'; | ||
if (~options.boolean.indexOf(key)) type = '[boolean]'; | ||
if (~options.count.indexOf(key)) type = '[count]'; | ||
if (~options.string.indexOf(key)) type = '[string]'; | ||
if (~options.normalize.indexOf(key)) type = '[string]'; | ||
if (~options.array.indexOf(key)) type = '[array]'; | ||
@@ -211,2 +214,25 @@ var extra = [ | ||
// make sure any options set for aliases, | ||
// are copied to the keys being aliased. | ||
function normalizeAliases () { | ||
var options = yargs.getOptions(), | ||
demanded = yargs.getDemanded(); | ||
(Object.keys(options.alias) || []).forEach(function(key) { | ||
options.alias[key].forEach(function(alias) { | ||
// copy descriptions. | ||
if (descriptions[alias]) self.describe(key, descriptions[alias]); | ||
// copy demanded. | ||
if (demanded[alias]) yargs.demand(key, demanded[alias].msg); | ||
// type messages. | ||
if (~options.boolean.indexOf(alias)) yargs.boolean(key); | ||
if (~options.count.indexOf(alias)) yargs.count(key); | ||
if (~options.string.indexOf(alias)) yargs.string(key); | ||
if (~options.normalize.indexOf(alias)) yargs.normalize(key); | ||
if (~options.array.indexOf(alias)) yargs.array(key); | ||
}); | ||
}); | ||
}; | ||
self.showHelp = function (level) { | ||
@@ -239,2 +265,5 @@ level = level || 'error'; | ||
break; | ||
case 'object': | ||
string += JSON.stringify(value); | ||
break; | ||
default: | ||
@@ -241,0 +270,0 @@ string += value; |
@@ -25,3 +25,4 @@ // validation-type-stuff, missing params, | ||
self.missingArgumentValue = function(argv) { | ||
var options = yargs.getOptions(); | ||
var options = yargs.getOptions(), | ||
defaultValues = [true, false, '']; | ||
@@ -34,4 +35,7 @@ if (options.requiresArg.length > 0) { | ||
// parser sets --foo value to true / --no-foo to false | ||
if (value === true || value === false) { | ||
// if a value is explicitly requested, | ||
// flag argument as missing if it does not | ||
// look like foo=bar was entered. | ||
if (~defaultValues.indexOf(value) | ||
|| (Array.isArray(value) && !value.length)) { | ||
missingRequiredArgs.push(key); | ||
@@ -38,0 +42,0 @@ } |
{ | ||
"name": "yargs", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "Light-weight option parsing with an argv hash. No optstrings attached.", | ||
@@ -19,12 +19,12 @@ "main": "./index.js", | ||
"devDependencies": { | ||
"blanket": "^1.1.6", | ||
"chai": "^1.10.0", | ||
"chai": "^2.2.0", | ||
"coveralls": "^2.11.2", | ||
"hashish": "0.0.4", | ||
"mocha": "2.1.0", | ||
"mocha-lcov-reporter": "0.0.1", | ||
"mocoverage": "^1.0.0" | ||
"mocha": "^2.2.1", | ||
"mocha-lcov-reporter": "0.0.2", | ||
"mocoverage": "^1.0.0", | ||
"patched-blanket": "^1.0.1" | ||
}, | ||
"scripts": { | ||
"test": "mocha --check-leaks --ui exports --require blanket -R mocoverage" | ||
"test": "mocha --check-leaks --ui exports --require patched-blanket -R mocoverage" | ||
}, | ||
@@ -31,0 +31,0 @@ "repository": { |
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
106619
1329