Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yargs

Package Overview
Dependencies
Maintainers
3
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yargs - npm Package Compare versions

Comparing version 3.9.1 to 3.10.0

5

CHANGELOG.md
## Change Log
### v3.10.0 (2015/05/29 04:25 +00:00)
- [#165](https://github.com/bcoe/yargs/pull/165) expose yargs.terminalWidth() thanks @ensonic (@bcoe)
- [#164](https://github.com/bcoe/yargs/pull/164) better array handling thanks @getify (@bcoe)
### v3.9.1 (2015/05/20 05:14 +00:00)

@@ -4,0 +9,0 @@ - [b6662b6](https://github.com/bcoe/yargs/commit/b6662b6774cfeab4876f41ec5e2f67b7698f4e2f) clarify .config() docs (@linclark)

4

index.js

@@ -382,2 +382,6 @@ var assert = require('assert'),

self.terminalWidth = function () {
return require('window-size').width
}
Object.defineProperty(self, 'argv', {

@@ -384,0 +388,0 @@ get: function () {

@@ -72,3 +72,4 @@ // fancy-pants parsing of argv, originally forked

m,
next
next,
value

@@ -81,3 +82,14 @@ // -- seperated by =

m = arg.match(/^--([^=]+)=([\s\S]*)$/)
setArg(m[1], m[2])
// nargs format = '--f=monkey washing cat'
if (checkAllAliases(m[1], opts.narg)) {
args.splice(i + 1, m[1], m[2])
i = eatNargs(i, m[1], args)
// arrays format = '--f=a b c'
} else if (checkAllAliases(m[1], flags.arrays) && args.length > i + 1) {
args.splice(i + 1, m[1], m[2])
i = eatArray(i, m[1], args)
} else {
setArg(m[1], m[2])
}
} else if (arg.match(/^--no-.+/)) {

@@ -91,4 +103,8 @@ key = arg.match(/^--no-(.+)/)[1]

// nargs format = '--foo a b c'
if (checkAllAliases(key, opts.narg)) {
i = eatNargs(i, key, args)
// array format = '--foo a b c'
} else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
i = eatArray(i, key, args)
} else {

@@ -136,3 +152,17 @@ next = args[i + 1]

if (letters[j + 1] && letters[j + 1] === '=') {
setArg(letters[j], arg.slice(j + 3))
value = arg.slice(j + 3)
key = letters[j]
// nargs format = '-f=monkey washing cat'
if (checkAllAliases(letters[j], opts.narg)) {
args.splice(i + 1, 0, value)
i = eatNargs(i, key, args)
// array format = '-f=a b c'
} else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
args.splice(i + 1, 0, value)
i = eatArray(i, key, args)
} else {
setArg(key, value)
}
broken = true

@@ -166,4 +196,8 @@ break

if (!broken && key !== '-') {
// nargs format = '-f a b c'
if (checkAllAliases(key, opts.narg)) {
i = eatNargs(i, key, args)
// array format = '-f a b c'
} else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
i = eatArray(i, key, args)
} else {

@@ -215,2 +249,15 @@ if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1])

// if an option is an array, eat all non-hyphenated arguments
// following it... YUM!
// e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
function eatArray (i, key, args) {
for (var ii = i + 1; ii < args.length; ii++) {
if (/^-/.test(args[ii])) break
i = ii
setArg(key, args[ii])
}
return i
}
function setArg (key, val) {

@@ -217,0 +264,0 @@ // handle parsing boolean arguments --foo=true --bar false.

6

package.json
{
"name": "yargs",
"version": "3.9.1",
"version": "3.10.0",
"description": "Light-weight option parsing with an argv hash. No optstrings attached.",

@@ -23,4 +23,4 @@ "main": "./index.js",

"mocha": "^2.2.1",
"nyc": "^2.0.0",
"standard": "^3.9.0"
"nyc": "^2.2.1",
"standard": "^3.11.1"
},

@@ -27,0 +27,0 @@ "scripts": {

@@ -598,3 +598,3 @@ yargs

Tell the parser to interpret `key` as an array. If `.array('foo')` is set,
`--foo bar` will be parsed as `['bar']` rather than as `'bar'`.
`--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'bar'`.

@@ -622,3 +622,3 @@ .nargs(key, count)

Tells the parser that if the option specified by `key` is passed in, it
Tells the parser that if the option specified by `key` is passed in, it
should be interpreted as a path to a JSON config file. The file is loaded

@@ -635,2 +635,5 @@ and parsed, and its properties are set as arguments.

`yargs.wrap(yargs.terminalWidth())` can be used to maximize the width
of yargs' usage instructions.
.strict()

@@ -637,0 +640,0 @@ ---------

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc