summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/yargs
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/node_modules/yargs')
-rw-r--r--tools/eslint/node_modules/yargs/LICENSE21
-rw-r--r--tools/eslint/node_modules/yargs/README.md926
-rw-r--r--tools/eslint/node_modules/yargs/completion.sh.hbs22
-rw-r--r--tools/eslint/node_modules/yargs/index.js504
-rw-r--r--tools/eslint/node_modules/yargs/lib/completion.js71
-rw-r--r--tools/eslint/node_modules/yargs/lib/parser.js448
-rw-r--r--tools/eslint/node_modules/yargs/lib/usage.js314
-rw-r--r--tools/eslint/node_modules/yargs/lib/validation.js196
-rw-r--r--tools/eslint/node_modules/yargs/package.json145
9 files changed, 0 insertions, 2647 deletions
diff --git a/tools/eslint/node_modules/yargs/LICENSE b/tools/eslint/node_modules/yargs/LICENSE
deleted file mode 100644
index 432d1aeb01..0000000000
--- a/tools/eslint/node_modules/yargs/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-Copyright 2010 James Halliday (mail@substack.net)
-
-This project is free software released under the MIT/X11 license:
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/tools/eslint/node_modules/yargs/README.md b/tools/eslint/node_modules/yargs/README.md
deleted file mode 100644
index 99086e6e95..0000000000
--- a/tools/eslint/node_modules/yargs/README.md
+++ /dev/null
@@ -1,926 +0,0 @@
-yargs
-========
-
-Yargs be a node.js library fer hearties tryin' ter parse optstrings.
-
-With yargs, ye be havin' a map that leads straight to yer treasure! Treasure of course, being a simple option hash.
-
-[![Build Status](https://travis-ci.org/bcoe/yargs.png)](https://travis-ci.org/bcoe/yargs)
-[![Dependency Status](https://gemnasium.com/bcoe/yargs.png)](https://gemnasium.com/bcoe/yargs)
-[![Coverage Status](https://coveralls.io/repos/bcoe/yargs/badge.svg?branch=)](https://coveralls.io/r/bcoe/yargs?branch=)
-[![NPM version](https://img.shields.io/npm/v/yargs.svg)](https://www.npmjs.com/package/yargs)
-
-> Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/bcoe/yargs/issues) :)
-
-examples
-========
-
-With yargs, the options be just a hash!
--------------------------------------------------------------------
-
-plunder.js:
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs').argv;
-
-if (argv.ships > 3 && argv.distance < 53.5) {
- console.log('Plunder more riffiwobbles!');
-}
-else {
- console.log('Retreat from the xupptumblers!');
-}
-````
-
-***
-
- $ ./plunder.js --ships=4 --distance=22
- Plunder more riffiwobbles!
-
- $ ./plunder.js --ships 12 --distance 98.7
- Retreat from the xupptumblers!
-
-![Joe was one optimistic pirate.](http://i.imgur.com/4WFGVJ9.png)
-
-But don't walk the plank just yet! There be more! You can do short options:
--------------------------------------------------
-
-short.js:
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs').argv;
-console.log('(%d,%d)', argv.x, argv.y);
-````
-
-***
-
- $ ./short.js -x 10 -y 21
- (10,21)
-
-And booleans, both long, short, and even grouped:
-----------------------------------
-
-bool.js:
-
-````javascript
-#!/usr/bin/env node
-var util = require('util');
-var argv = require('yargs').argv;
-
-if (argv.s) {
- util.print(argv.fr ? 'Le perroquet dit: ' : 'The parrot says: ');
-}
-console.log(
- (argv.fr ? 'couac' : 'squawk') + (argv.p ? '!' : '')
-);
-````
-
-***
-
- $ ./bool.js -s
- The parrot says: squawk
-
- $ ./bool.js -sp
- The parrot says: squawk!
-
- $ ./bool.js -sp --fr
- Le perroquet dit: couac!
-
-And non-hyphenated options too! Just use `argv._`!
--------------------------------------------------
-
-nonopt.js:
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs').argv;
-console.log('(%d,%d)', argv.x, argv.y);
-console.log(argv._);
-````
-
-***
-
- $ ./nonopt.js -x 6.82 -y 3.35 rum
- (6.82,3.35)
- [ 'rum' ]
-
- $ ./nonopt.js "me hearties" -x 0.54 yo -y 1.12 ho
- (0.54,1.12)
- [ 'me hearties', 'yo', 'ho' ]
-
-Yargs even counts your booleans!
-----------------------------------------------------------------------
-
-count.js
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .count('verbose')
- .alias('v', 'verbose')
- .argv;
-
-VERBOSE_LEVEL = argv.verbose;
-
-function WARN() { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); }
-function INFO() { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); }
-function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); }
-
-WARN("Showing only important stuff");
-INFO("Showing semi-mportant stuff too");
-DEBUG("Extra chatty mode");
-````
-
-***
- $ node count.js
- Showing only important stuff
-
- $ node count.js -v
- Showing only important stuff
- Showing semi-important stuff too
-
- $ node count.js -vv
- Showing only important stuff
- Showing semi-important stuff too
- Extra chatty mode
-
- $ node count.js -v --verbose
- Showing only important stuff
- Showing semi-important stuff too
- Extra chatty mode
-
-Tell users how to use yer options and make demands.
--------------------------------------------------
-
-area.js:
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .usage('Usage: $0 -w [num] -yh[num]')
- .demand(['w','h'])
- .argv;
-
-console.log("The area is:", argv.w * argv.h);
-````
-
-***
-
- $ ./area.js -w 55 -h 11
- 605
-
- $ node ./area.js -w 4.91 -w 2.51
- Usage: node ./area.js -w [num] -h [num]
-
- Options:
- -w [required]
- -h [required]
-
- Missing required arguments: h
-
-After yer demands have been met, demand more! Ask for non-hypenated arguments!
------------------------------------------
-
-demand_count.js:
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .demand(2)
- .argv;
-console.dir(argv)
-````
-
-***
-
- $ ./demand_count.js a
- Not enough arguments, expected 2, but only found 1
- $ ./demand_count.js a b
- { _: [ 'a', 'b' ], '$0': 'node ./demand_count.js' }
- $ ./demand_count.js a b c
- { _: [ 'a', 'b', 'c' ], '$0': 'node ./demand_count.js' }
-
-EVEN MORE SHIVER ME TIMBERS!
-------------------
-
-default_singles.js:
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .default('x', 10)
- .default('y', 10)
- .argv
-;
-console.log(argv.x + argv.y);
-````
-
-***
-
- $ ./default_singles.js -x 5
- 15
-
-default_hash.js:
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .default({ x : 10, y : 10 })
- .argv
-;
-console.log(argv.x + argv.y);
-````
-
-***
-
- $ ./default_hash.js -y 7
- 17
-
-And if you really want to get all descriptive about it...
----------------------------------------------------------
-
-boolean_single.js
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .boolean('v')
- .argv
-;
-console.dir(argv.v);
-console.dir(argv._);
-````
-
-***
-
- $ ./boolean_single.js -v "me hearties" yo ho
- true
- [ 'me hearties', 'yo', 'ho' ]
-
-
-boolean_double.js
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .boolean(['x','y','z'])
- .argv
-;
-console.dir([ argv.x, argv.y, argv.z ]);
-console.dir(argv._);
-````
-
-***
-
- $ ./boolean_double.js -x -z one two three
- [ true, false, true ]
- [ 'one', 'two', 'three' ]
-
-Yargs is here to help you...
----------------------------
-
-Ye can describe parameters fer help messages and set aliases. Yargs figures
-out how ter format a handy help string automatically.
-
-line_count.js
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .usage('Usage: $0 <command> [options]')
- .command('count', 'Count the lines in a file')
- .demand(1)
- .example('$0 count -f foo.js', 'count the lines in the given file')
- .demand('f')
- .alias('f', 'file')
- .nargs('f', 1)
- .describe('f', 'Load a file')
- .help('h')
- .alias('h', 'help')
- .epilog('copyright 2015')
- .argv;
-
-var fs = require('fs');
-var s = fs.createReadStream(argv.file);
-
-var lines = 0;
-s.on('data', function (buf) {
- lines += buf.toString().match(/\n/g).length;
-});
-
-s.on('end', function () {
- console.log(lines);
-});
-````
-
-***
- $ node line_count.js count
- Usage: node test.js <command> [options]
-
- Commands:
- count Count the lines in a file
-
- Options:
- -f, --file Load a file [required]
- -h, --help Show help
-
- Examples:
- node test.js count -f foo.js count the lines in the given file
-
- copyright 2015
-
- Missing required arguments: f
-
- $ node line_count.js count --file line_count.js
- 20
-
- $ node line_count.js count -f line_count.js
- 20
-
-methods
-=======
-
-By itself,
-
-````javascript
-require('yargs').argv
-`````
-
-will use `process.argv` array to construct the `argv` object.
-
-You can pass in the `process.argv` yourself:
-
-````javascript
-require('yargs')([ '-x', '1', '-y', '2' ]).argv
-````
-
-or use .parse() to do the same thing:
-
-````javascript
-require('yargs').parse([ '-x', '1', '-y', '2' ])
-````
-
-The rest of these methods below come in just before the terminating `.argv`.
-
-.alias(key, alias)
-------------------
-
-Set key names as equivalent such that updates to a key will propagate to aliases
-and vice-versa.
-
-Optionally `.alias()` can take an object that maps keys to aliases.
-Each key of this object should be the canonical version of the option, and each
-value should be a string or an array of strings.
-
-.default(key, value, [description])
---------------------
-
-Set `argv[key]` to `value` if no option was specified on `process.argv`.
-
-Optionally `.default()` can take an object that maps keys to default values.
-
-But wait, there's more! the default value can be a `function` which returns
-a value. The name of the function will be used in the usage string:
-
-```js
-var argv = require('yargs')
- .default('random', function randomValue() {
- return Math.random() * 256;
- }).argv;
-```
-
-Optionally, `description` can also be provided and will take precedence over
-displaying the value in the usage instructions:
-
-```js
-.default('timeout', 60000, '(one-minute)');
-```
-
-.demand(key, [msg | boolean])
------------------------------
-.require(key, [msg | boolean])
-------------------------------
-.required(key, [msg | boolean])
--------------------------------
-
-If `key` is a string, show the usage information and exit if `key` wasn't
-specified in `process.argv`.
-
-If `key` is a number, demand at least as many non-option arguments, which show
-up in `argv._`.
-
-If `key` is an Array, demand each element.
-
-If a `msg` string is given, it will be printed when the argument is missing,
-instead of the standard error message. This is especially helpful for the non-option arguments in `argv._`.
-
-If a `boolean` value is given, it controls whether the option is demanded;
-this is useful when using `.options()` to specify command line parameters.
-
-.requiresArg(key)
------------------
-
-Specifies either a single option key (string), or an array of options that
-must be followed by option values. If any option value is missing, show the
-usage information and exit.
-
-The default behaviour is to set the value of any key not followed by an
-option value to `true`.
-
-.implies(x, y)
---------------
-
-Given the key `x` is set, it is required that the key `y` is set.
-
-implies can also accept an object specifying multiple implications.
-
-.describe(key, desc)
---------------------
-
-Describe a `key` for the generated usage information.
-
-Optionally `.describe()` can take an object that maps keys to descriptions.
-
-.option(key, opt)
------------------
-.options(key, opt)
-------------------
-
-Instead of chaining together `.alias().demand().default().describe().string()`, you can specify
-keys in `opt` for each of the chainable methods.
-
-For example:
-
-````javascript
-var argv = require('yargs')
- .option('f', {
- alias : 'file',
- demand: true,
- default: '/etc/passwd',
- describe: 'x marks the spot',
- type: 'string'
- })
- .argv
-;
-````
-
-is the same as
-
-````javascript
-var argv = require('yargs')
- .alias('f', 'file')
- .default('f', '/etc/passwd')
- .argv
-;
-````
-
-Optionally `.options()` can take an object that maps keys to `opt` parameters.
-
-````javascript
-var argv = require('yargs')
- .options({
- 'f': {
- alias: 'file',
- demand: true,
- default: '/etc/passwd',
- describe: 'x marks the spot',
- type: 'string'
- }
- })
- .argv
-;
-````
-
-.usage(message, opts)
----------------------
-
-Set a usage message to show which commands to use. Inside `message`, the string
-`$0` will get interpolated to the current script name or node command for the
-present script similar to how `$0` works in bash or perl.
-
-`opts` is optional and acts like calling `.options(opts)`.
-
-.command(cmd, desc, [fn])
--------------------
-
-Document the commands exposed by your application.
-
-use `desc` to provide a description for each command your application accepts (the
-values stored in `argv._`).
-
-Optionally, you can provide a handler `fn` which will be executed when
-a given command is provided. The handler will be executed with an instance
-of `yargs`, which can be used to compose nested commands.
-
-Here's an example of top-level and nested commands in action:
-
-```js
-var argv = require('yargs')
- .usage('npm <command>')
- .command('install', 'tis a mighty fine package to install')
- .command('publish', 'shiver me timbers, should you be sharing all that', function (yargs) {
- argv = yargs.option('f', {
- alias: 'force',
- description: 'yar, it usually be a bad idea'
- })
- .help('help')
- .argv
- })
- .help('help')
- .argv;
-```
-
-.example(cmd, desc)
--------------------
-
-Give some example invocations of your program. Inside `cmd`, the string
-`$0` will get interpolated to the current script name or node command for the
-present script similar to how `$0` works in bash or perl.
-Examples will be printed out as part of the help message.
-
-
-.epilogue(str)
---------------
-.epilog(str)
-------------
-
-A message to print at the end of the usage instructions, e.g.,
-
-```js
-var argv = require('yargs')
- .epilogue('for more information, find our manual at http://example.com');
-```
-
-.check(fn)
-----------
-
-Check that certain conditions are met in the provided arguments.
-
-`fn` is called with two arguments, the parsed `argv` hash and an array of options and their aliases.
-
-If `fn` throws or returns a non-truthy value, show the thrown error, usage information, and
-exit.
-
-.fail(fn)
----------
-
-Method to execute when a failure occurs, rather then printing the failure message.
-
-`fn` is called with the failure message that would have been printed.
-
-.boolean(key)
--------------
-
-Interpret `key` as a boolean. If a non-flag option follows `key` in
-`process.argv`, that string won't get set as the value of `key`.
-
-`key` will default to `false`, unless an `default(key, undefined)` is
-explicitly set.
-
-If `key` is an Array, interpret all the elements as booleans.
-
-.string(key)
-------------
-
-Tell the parser logic not to interpret `key` as a number or boolean.
-This can be useful if you need to preserve leading zeros in an input.
-
-If `key` is an Array, interpret all the elements as strings.
-
-`.string('_')` will result in non-hyphenated arguments being interpreted as strings,
-regardless of whether they resemble numbers.
-
-.array(key)
-----------
-
-Tell the parser to interpret `key` as an array. If `.array('foo')` is set,
-`--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'bar'`.
-
-.nargs(key, count)
------------
-
-The number of arguments that should be consumed after a key. This can be a
-useful hint to prevent parsing ambiguity:
-
-```js
-var argv = require('yargs')
- .nargs('token', 1)
- .parse(['--token', '-my-token']);
-```
-
-parses as:
-
-`{ _: [], token: '-my-token', '$0': 'node test' }`
-
-Optionally `.nargs()` can take an object of `key`/`narg` pairs.
-
-.config(key)
-------------
-
-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
-and parsed, and its properties are set as arguments.
-
-.wrap(columns)
---------------
-
-Format usage output to wrap at `columns` many columns.
-
-By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to
-specify no column limit.
-
-`yargs.wrap(yargs.terminalWidth())` can be used to maximize the width
-of yargs' usage instructions.
-
-.strict()
----------
-
-Any command-line argument given that is not demanded, or does not have a
-corresponding description, will be reported as an error.
-
-.help([option, [description]])
-------------------------------
-
-Add an option (e.g., `--help`) that displays the usage string and exits the
-process. If present, the `description` parameter customises the description of
-the help option in the usage string.
-
-If invoked without parameters, `.help` returns the generated usage string.
-
-Example:
-
-```
-var yargs = require("yargs")
- .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
-console.log(yargs.help());
-```
-
-Later on, ```argv``` can be retrived with ```yargs.argv```
-
-.version(version, [option], [description])
-----------------------------------------
-
-Add an option (e.g., `--version`) that displays the version number (given by the
-`version` parameter) and exits the process. If present, the `description`
-parameter customizes the description of the version option in the usage string.
-
-You can provide a `function` for version, rather than a string.
-This is useful if you want to use the version from your package.json:
-
-```js
-var argv = require('yargs')
- .version(function() {
- return require('../package').version;
- })
- .argv;
-```
-
-.showHelpOnFail(enable, [message])
-----------------------------------
-
-By default, yargs outputs a usage string if any error is detected. Use the
-`.showHelpOnFail` method to customize this behaviour. if `enable` is `false`,
-the usage string is not output. If the `message` parameter is present, this
-message is output after the error message.
-
-line_count.js
-
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .usage('Count the lines in a file.\nUsage: $0')
- .demand('f')
- .alias('f', 'file')
- .describe('f', 'Load a file')
- .showHelpOnFail(false, "Specify --help for available options")
- .argv;
-
-// etc.
-````
-
-***
-
- $ node line_count.js --file
- Missing argument value: f
-
- Specify --help for available options
-
-.showHelp(consoleLevel='error')
----------------------------
-
-Print the usage data using the [`console`](https://nodejs.org/api/console.html) function `consoleLevel` for printing.
-
-Example:
-
-```
-var yargs = require("yargs")
- .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
-yargs.showHelp();
-```
-
-Or, to print the usage data to `stdout` instead, you can specify the use of `console.log`:
-
-```
-yargs.showHelp("log");
-```
-
-Later on, ```argv``` can be retrived with ```yargs.argv```
-
-.completion(cmd, [description], [fn]);
--------------
-
-Enable bash-completion shortcuts for commands and options.
-
-`cmd`: when present in `argv._`, will result in the `.bashrc` completion script
-being outputted. To enable bash completions, concat the generated script to your
-`.bashrc`, or `.bash_profile`.
-
-`description`: provide a description in your usage instructions for the command
-that generates bash completion scripts.
-
-`fn`, rather than relying on yargs' default completion functionlity, which
-shiver me timbers is pretty awesome, you can provide your own completion
-method.
-
-```js
-var argv = require('yargs')
- .completion('completion', function(current, argv) {
- // 'current' is the current command being completed.
- // 'argv' is the parsed arguments so far.
- // simply return an array of completions.
- return [
- 'foo',
- 'bar'
- ];
- })
- .argv;
-```
-
-But wait, there's more! you can provide asynchronous completions.
-
-```js
-var argv = require('yargs')
- .completion('completion', function(current, argv, done) {
- setTimeout(function() {
- done([
- 'apple',
- 'banana'
- ]);
- }, 500);
- })
- .argv;
-```
-
-.showCompletionScript()
-----------------------
-
-Generate a bash completion script. Users of your application can install this
-script in their `.bashrc`, and yargs will provide completion shortcuts for
-commands and options.
-
-.exitProcess(enable)
-----------------------------------
-
-By default, yargs exits the process when the user passes a help flag, uses the `.version` functionality or when validation fails. Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated.
-
-.parse(args)
-------------
-
-Parse `args` instead of `process.argv`. Returns the `argv` object.
-
-.reset()
---------
-
-Reset the argument object built up so far. This is useful for
-creating nested command line interfaces.
-
-```js
-var yargs = require('./yargs')
- .usage('$0 command')
- .command('hello', 'hello command')
- .command('world', 'world command')
- .demand(1, 'must provide a valid command'),
- argv = yargs.argv,
- command = argv._[0];
-
-if (command === 'hello') {
- yargs.reset()
- .usage('$0 hello')
- .help('h')
- .example('$0 hello', 'print the hello message!')
- .argv
-
- console.log('hello!');
-} else if (command === 'world'){
- yargs.reset()
- .usage('$0 world')
- .help('h')
- .example('$0 world', 'print the world message!')
- .argv
-
- console.log('world!');
-} else {
- yargs.showHelp();
-}
-```
-
-.argv
------
-
-Get the arguments as a plain old object.
-
-Arguments without a corresponding flag show up in the `argv._` array.
-
-The script name or node command is available at `argv.$0` similarly to how `$0`
-works in bash or perl.
-
-parsing tricks
-==============
-
-stop parsing
-------------
-
-Use `--` to stop parsing flags and stuff the remainder into `argv._`.
-
- $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4
- { _: [ '-c', '3', '-d', '4' ],
- '$0': 'node ./examples/reflect.js',
- a: 1,
- b: 2 }
-
-negate fields
--------------
-
-If you want to explicity set a field to false instead of just leaving it
-undefined or to override a default you can do `--no-key`.
-
- $ node examples/reflect.js -a --no-b
- { _: [],
- '$0': 'node ./examples/reflect.js',
- a: true,
- b: false }
-
-numbers
--------
-
-Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to
-one. This way you can just `net.createConnection(argv.port)` and you can add
-numbers out of `argv` with `+` without having that mean concatenation,
-which is super frustrating.
-
-duplicates
-----------
-
-If you specify a flag multiple times it will get turned into an array containing
-all the values in order.
-
- $ node examples/reflect.js -x 5 -x 8 -x 0
- { _: [],
- '$0': 'node ./examples/reflect.js',
- x: [ 5, 8, 0 ] }
-
-dot notation
-------------
-
-When you use dots (`.`s) in argument names, an implicit object path is assumed.
-This lets you organize arguments into nested objects.
-
- $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5
- { _: [],
- '$0': 'node ./examples/reflect.js',
- foo: { bar: { baz: 33 }, quux: 5 } }
-
-short numbers
--------------
-
-Short numeric `head -n5` style argument work too:
-
- $ node reflect.js -n123 -m456
- { '3': true,
- '6': true,
- _: [],
- '$0': 'node ./reflect.js',
- n: 123,
- m: 456 }
-
-installation
-============
-
-With [npm](http://github.com/isaacs/npm), just do:
-
- npm install yargs
-
-or clone this project on github:
-
- git clone http://github.com/bcoe/yargs.git
-
-To run the tests with npm, just do:
-
- npm test
-
-inspired by
-===========
-
-This module is loosely inspired by Perl's
-[Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm).
diff --git a/tools/eslint/node_modules/yargs/completion.sh.hbs b/tools/eslint/node_modules/yargs/completion.sh.hbs
deleted file mode 100644
index c52e499144..0000000000
--- a/tools/eslint/node_modules/yargs/completion.sh.hbs
+++ /dev/null
@@ -1,22 +0,0 @@
-###-begin-{{app_name}}-completions-###
-#
-# yargs command completion script
-#
-# Installation: {{app_path}} completion >> ~/.bashrc
-# or {{app_path}} completion >> ~/.bash_profile on OSX.
-#
-_yargs_completions()
-{
- local cur_word args type_list
-
- cur_word="${COMP_WORDS[COMP_CWORD]}"
- args=$(printf "%s " "${COMP_WORDS[@]}")
-
- # ask yargs to generate completions.
- type_list=`{{app_path}} --get-yargs-completions $args`
-
- COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )
- return 0
-}
-complete -F _yargs_completions {{app_name}}
-###-end-{{app_name}}-completions-###
diff --git a/tools/eslint/node_modules/yargs/index.js b/tools/eslint/node_modules/yargs/index.js
deleted file mode 100644
index 96539b08d0..0000000000
--- a/tools/eslint/node_modules/yargs/index.js
+++ /dev/null
@@ -1,504 +0,0 @@
-var assert = require('assert'),
- path = require('path'),
- Completion = require('./lib/completion'),
- Parser = require('./lib/parser'),
- Usage = require('./lib/usage'),
- Validation = require('./lib/validation')
-
-Argv(process.argv.slice(2))
-
-var exports = module.exports = Argv
-function Argv (processArgs, cwd) {
- processArgs = processArgs || [] // handle calling yargs().
-
- var self = {}
- var completion = null
- var usage = null
- var validation = null
-
- if (!cwd) cwd = process.cwd()
-
- self.$0 = process.argv
- .slice(0, 2)
- .map(function (x, i) {
- // ignore the node bin, specify this in your
- // bin file with #!/usr/bin/env node
- if (i === 0 && /\b(node|iojs)$/.test(x)) return
- var b = rebase(cwd, x)
- return x.match(/^\//) && b.length < x.length
- ? b : x
- })
- .join(' ').trim()
-
- if (process.env._ !== undefined && process.argv[1] === process.env._) {
- self.$0 = process.env._.replace(
- path.dirname(process.execPath) + '/', ''
- )
- }
-
- var options
- self.resetOptions = self.reset = function () {
- // put yargs back into its initial
- // state, this is useful for creating a
- // nested CLI.
- options = {
- array: [],
- boolean: [],
- string: [],
- narg: {},
- key: {},
- alias: {},
- default: {},
- defaultDescription: {},
- requiresArg: [],
- count: [],
- normalize: [],
- config: []
- }
-
- usage = Usage(self) // handle usage output.
- validation = Validation(self, usage) // handle arg validation.
- completion = Completion(self, usage)
-
- demanded = {}
-
- exitProcess = true
- strict = false
- helpOpt = null
- versionOpt = null
- completionOpt = null
- commandHandlers = {}
- self.parsed = false
-
- return self
- }
- self.resetOptions()
-
- self.boolean = function (bools) {
- options.boolean.push.apply(options.boolean, [].concat(bools))
- return self
- }
-
- self.array = function (arrays) {
- options.array.push.apply(options.array, [].concat(arrays))
- return self
- }
-
- self.nargs = function (key, n) {
- if (typeof key === 'object') {
- Object.keys(key).forEach(function (k) {
- self.nargs(k, key[k])
- })
- } else {
- options.narg[key] = n
- }
- return self
- }
-
- self.normalize = function (strings) {
- options.normalize.push.apply(options.normalize, [].concat(strings))
- return self
- }
-
- self.config = function (configs) {
- options.config.push.apply(options.config, [].concat(configs))
- return self
- }
-
- self.example = function (cmd, description) {
- usage.example(cmd, description)
- return self
- }
-
- self.command = function (cmd, description, fn) {
- usage.command(cmd, description)
- if (fn) commandHandlers[cmd] = fn
- return self
- }
-
- var commandHandlers = {}
- self.getCommandHandlers = function () {
- return commandHandlers
- }
-
- self.string = function (strings) {
- options.string.push.apply(options.string, [].concat(strings))
- return self
- }
-
- self.default = function (key, value, defaultDescription) {
- if (typeof key === 'object') {
- Object.keys(key).forEach(function (k) {
- self.default(k, key[k])
- })
- } else {
- if (typeof value === 'function') {
- defaultDescription = usage.functionDescription(value, defaultDescription)
- value = value.call()
- }
- options.defaultDescription[key] = defaultDescription
- options.default[key] = value
- }
- return self
- }
-
- self.alias = function (x, y) {
- if (typeof x === 'object') {
- Object.keys(x).forEach(function (key) {
- self.alias(key, x[key])
- })
- } else {
- options.alias[x] = (options.alias[x] || []).concat(y)
- }
- return self
- }
-
- self.count = function (counts) {
- options.count.push.apply(options.count, [].concat(counts))
- return self
- }
-
- var demanded = {}
- self.demand = self.required = self.require = function (keys, msg) {
- if (typeof keys === 'number') {
- if (!demanded._) demanded._ = { count: 0, msg: null }
- demanded._.count += keys
- demanded._.msg = msg
- } else if (Array.isArray(keys)) {
- keys.forEach(function (key) {
- self.demand(key, msg)
- })
- } else {
- if (typeof msg === 'string') {
- demanded[keys] = { msg: msg }
- } else if (msg === true || typeof msg === 'undefined') {
- demanded[keys] = { msg: undefined }
- }
- }
-
- return self
- }
- self.getDemanded = function () {
- return demanded
- }
-
- self.requiresArg = function (requiresArgs) {
- options.requiresArg.push.apply(options.requiresArg, [].concat(requiresArgs))
- return self
- }
-
- self.implies = function (key, value) {
- validation.implies(key, value)
- return self
- }
-
- self.usage = function (msg, opts) {
- if (!opts && typeof msg === 'object') {
- opts = msg
- msg = null
- }
-
- usage.usage(msg)
-
- if (opts) self.options(opts)
-
- return self
- }
-
- self.epilogue = self.epilog = function (msg) {
- usage.epilog(msg)
- return self
- }
-
- self.fail = function (f) {
- usage.failFn(f)
- return self
- }
-
- self.check = function (f) {
- validation.check(f)
- return self
- }
-
- self.defaults = self.default
-
- self.describe = function (key, desc) {
- options.key[key] = true
- usage.describe(key, desc)
- return self
- }
-
- self.parse = function (args) {
- return parseArgs(args)
- }
-
- self.option = self.options = function (key, opt) {
- if (typeof key === 'object') {
- Object.keys(key).forEach(function (k) {
- self.options(k, key[k])
- })
- } else {
- assert(typeof opt === 'object', 'second argument to option must be an object')
-
- options.key[key] = true // track manually set keys.
-
- if (opt.alias) self.alias(key, opt.alias)
-
- var demand = opt.demand || opt.required || opt.require
-
- if (demand) {
- self.demand(key, demand)
- } if ('default' in opt) {
- self.default(key, opt.default)
- } if ('nargs' in opt) {
- self.nargs(key, opt.nargs)
- } if (opt.boolean || opt.type === 'boolean') {
- self.boolean(key)
- if (opt.alias) self.boolean(opt.alias)
- } if (opt.array || opt.type === 'array') {
- self.array(key)
- if (opt.alias) self.array(opt.alias)
- } if (opt.string || opt.type === 'string') {
- self.string(key)
- if (opt.alias) self.string(opt.alias)
- } if (opt.count || opt.type === 'count') {
- self.count(key)
- }
-
- var desc = opt.describe || opt.description || opt.desc
- if (desc) {
- self.describe(key, desc)
- }
-
- if (opt.requiresArg) {
- self.requiresArg(key)
- }
- }
-
- return self
- }
- self.getOptions = function () {
- return options
- }
-
- self.wrap = function (cols) {
- usage.wrap(cols)
- return self
- }
-
- var strict = false
- self.strict = function () {
- strict = true
- return self
- }
- self.getStrict = function () {
- return strict
- }
-
- self.showHelp = function (level) {
- if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed.
- usage.showHelp(level)
- return self
- }
-
- var versionOpt = null
- self.version = function (ver, opt, msg) {
- versionOpt = opt || 'version'
- usage.version(ver)
- self.boolean(versionOpt)
- self.describe(versionOpt, msg || 'Show version number')
- return self
- }
-
- var helpOpt = null
- self.addHelpOpt = function (opt, msg) {
- helpOpt = opt
- self.boolean(opt)
- self.describe(opt, msg || 'Show help')
- return self
- }
-
- self.showHelpOnFail = function (enabled, message) {
- usage.showHelpOnFail(enabled, message)
- return self
- }
-
- var exitProcess = true
- self.exitProcess = function (enabled) {
- if (typeof enabled !== 'boolean') {
- enabled = true
- }
- exitProcess = enabled
- return self
- }
- self.getExitProcess = function () {
- return exitProcess
- }
-
- self.help = function () {
- if (arguments.length > 0) return self.addHelpOpt.apply(self, arguments)
-
- if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed.
-
- return usage.help()
- }
-
- var completionOpt = null,
- completionCommand = null
- self.completion = function (cmd, desc, fn) {
- // a function to execute when generating
- // completions can be provided as the second
- // or third argument to completion.
- if (typeof desc === 'function') {
- fn = desc
- desc = null
- }
-
- // register the completion command.
- completionCommand = cmd
- completionOpt = completion.completionKey
- self.command(completionCommand, desc || 'generate bash completion script')
-
- // a function can be provided
- if (fn) completion.registerFunction(fn)
-
- return self
- }
-
- self.showCompletionScript = function ($0) {
- $0 = $0 || self.$0
- console.log(completion.generateCompletionScript($0))
- return self
- }
-
- self.getUsageInstance = function () {
- return usage
- }
-
- self.getValidationInstance = function () {
- return validation
- }
-
- self.terminalWidth = function () {
- return require('window-size').width
- }
-
- Object.defineProperty(self, 'argv', {
- get: function () {
- var args = null
-
- try {
- args = parseArgs(processArgs)
- } catch (err) {
- usage.fail(err.message)
- }
-
- return args
- },
- enumerable: true
- })
-
- function parseArgs (args) {
- var parsed = Parser(args, options),
- argv = parsed.argv,
- aliases = parsed.aliases
-
- argv.$0 = self.$0
-
- self.parsed = parsed
-
- // generate a completion script for adding to ~/.bashrc.
- if (completionCommand && ~argv._.indexOf(completionCommand)) {
- self.showCompletionScript()
- if (exitProcess) {
- process.exit(0)
- }
- }
-
- // if there's a handler associated with a
- // command defer processing to it.
- var handlerKeys = Object.keys(self.getCommandHandlers())
- for (var i = 0, command; (command = handlerKeys[i]) !== undefined; i++) {
- if (~argv._.indexOf(command)) {
- self.getCommandHandlers()[command](self.reset())
- return self.argv
- }
- }
-
- Object.keys(argv).forEach(function (key) {
- if (key === helpOpt && argv[key]) {
- self.showHelp('log')
- if (exitProcess) {
- process.exit(0)
- }
- } else if (key === versionOpt && argv[key]) {
- usage.showVersion()
- if (exitProcess) {
- process.exit(0)
- }
- } else if (key === completionOpt) {
- // we allow for asynchronous completions,
- // e.g., loading in a list of commands from an API.
- completion.getCompletion(function (completions) {
- ;(completions || []).forEach(function (completion) {
- console.log(completion)
- })
-
- if (exitProcess) {
- process.exit(0)
- }
- })
- return
- }
- })
-
- validation.nonOptionCount(argv)
- validation.missingArgumentValue(argv)
- validation.requiredArguments(argv)
-
- if (strict) {
- validation.unknownArguments(argv, aliases)
- }
-
- validation.customChecks(argv, aliases)
- validation.implications(argv)
- setPlaceholderKeys(argv)
-
- return argv
- }
-
- function setPlaceholderKeys (argv) {
- Object.keys(options.key).forEach(function (key) {
- if (typeof argv[key] === 'undefined') argv[key] = undefined
- })
- }
-
- sigletonify(self)
- return self
-}
-
-// rebase an absolute path to a relative one with respect to a base directory
-// exported for tests
-exports.rebase = rebase
-function rebase (base, dir) {
- return path.relative(base, dir)
-}
-
-/* Hack an instance of Argv with process.argv into Argv
- so people can do
- require('yargs')(['--beeble=1','-z','zizzle']).argv
- to parse a list of args and
- require('yargs').argv
- to get a parsed version of process.argv.
-*/
-function sigletonify (inst) {
- Object.keys(inst).forEach(function (key) {
- if (key === 'argv') {
- Argv.__defineGetter__(key, inst.__lookupGetter__(key))
- } else {
- Argv[key] = typeof inst[key] === 'function'
- ? inst[key].bind(inst)
- : inst[key]
- }
- })
-}
diff --git a/tools/eslint/node_modules/yargs/lib/completion.js b/tools/eslint/node_modules/yargs/lib/completion.js
deleted file mode 100644
index 32387be27a..0000000000
--- a/tools/eslint/node_modules/yargs/lib/completion.js
+++ /dev/null
@@ -1,71 +0,0 @@
-var fs = require('fs'),
- path = require('path')
-
-// add bash completions to your
-// yargs-powered applications.
-module.exports = function (yargs, usage) {
- var self = {
- completionKey: 'get-yargs-completions'
- }
-
- // get a list of completion commands.
- self.getCompletion = function (done) {
- var completions = [],
- current = process.argv[process.argv.length - 1],
- previous = process.argv.slice(process.argv.indexOf('--' + self.completionKey) + 1),
- argv = yargs.parse(previous)
-
- // a custom completion function can be provided
- // to completion().
- if (completionFunction) {
- if (completionFunction.length < 3) {
- // synchronous completion function.
- return done(completionFunction(current, argv))
- } else {
- // asynchronous completion function
- return completionFunction(current, argv, function (completions) {
- done(completions)
- })
- }
- }
-
- if (!current.match(/^-/)) {
- usage.getCommands().forEach(function (command) {
- completions.push(command[0])
- })
- }
-
- if (current.match(/^-/)) {
- Object.keys(yargs.getOptions().key).forEach(function (key) {
- completions.push('--' + key)
- })
- }
-
- done(completions)
- }
-
- // generate the completion script to add to your .bashrc.
- self.generateCompletionScript = function ($0) {
- var script = fs.readFileSync(
- path.resolve(__dirname, '../completion.sh.hbs'),
- 'utf-8'
- ),
- name = path.basename($0)
-
- // add ./to applications not yet installed as bin.
- if ($0.match(/\.js$/)) $0 = './' + $0
-
- script = script.replace(/{{app_name}}/g, name)
- return script.replace(/{{app_path}}/g, $0)
- }
-
- // register a function to perform your own custom
- // completions., this function can be either
- // synchrnous or asynchronous.
- var completionFunction = null
- self.registerFunction = function (fn) {
- completionFunction = fn
- }
-
- return self
-}
diff --git a/tools/eslint/node_modules/yargs/lib/parser.js b/tools/eslint/node_modules/yargs/lib/parser.js
deleted file mode 100644
index 5e4618cb5c..0000000000
--- a/tools/eslint/node_modules/yargs/lib/parser.js
+++ /dev/null
@@ -1,448 +0,0 @@
-// fancy-pants parsing of argv, originally forked
-// from minimist: https://www.npmjs.com/package/minimist
-var camelCase = require('camelcase'),
- path = require('path')
-
-function increment (orig) {
- return orig !== undefined ? orig + 1 : 0
-}
-
-module.exports = function (args, opts) {
- if (!opts) opts = {}
- var flags = { arrays: {}, bools: {}, strings: {}, counts: {}, normalize: {}, configs: {} }
-
- ;[].concat(opts['array']).filter(Boolean).forEach(function (key) {
- flags.arrays[key] = true
- })
-
- ;[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
- flags.bools[key] = true
- })
-
- ;[].concat(opts.string).filter(Boolean).forEach(function (key) {
- flags.strings[key] = true
- })
-
- ;[].concat(opts.count).filter(Boolean).forEach(function (key) {
- flags.counts[key] = true
- })
-
- ;[].concat(opts.normalize).filter(Boolean).forEach(function (key) {
- flags.normalize[key] = true
- })
-
- ;[].concat(opts.config).filter(Boolean).forEach(function (key) {
- flags.configs[key] = true
- })
-
- var aliases = {},
- newAliases = {}
-
- extendAliases(opts.key)
- extendAliases(opts.alias)
-
- var defaults = opts['default'] || {}
- Object.keys(defaults).forEach(function (key) {
- if (/-/.test(key) && !opts.alias[key]) {
- aliases[key] = aliases[key] || []
- }
- (aliases[key] || []).forEach(function (alias) {
- defaults[alias] = defaults[key]
- })
- })
-
- var argv = { _: [] }
-
- Object.keys(flags.bools).forEach(function (key) {
- setArg(key, !(key in defaults) ? false : defaults[key])
- })
-
- var notFlags = []
- if (args.indexOf('--') !== -1) {
- notFlags = args.slice(args.indexOf('--') + 1)
- args = args.slice(0, args.indexOf('--'))
- }
-
- for (var i = 0; i < args.length; i++) {
- var arg = args[i],
- broken,
- key,
- letters,
- m,
- next,
- value
-
- // -- seperated by =
- if (arg.match(/^--.+=/)) {
- // Using [\s\S] instead of . because js doesn't support the
- // 'dotall' regex modifier. See:
- // http://stackoverflow.com/a/1068308/13216
- m = arg.match(/^--([^=]+)=([\s\S]*)$/)
-
- // 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-.+/)) {
- key = arg.match(/^--no-(.+)/)[1]
- setArg(key, false)
-
- // -- seperated by space.
- } else if (arg.match(/^--.+/)) {
- key = arg.match(/^--(.+)/)[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 {
- next = args[i + 1]
-
- if (next !== undefined && !next.match(/^-/)
- && !checkAllAliases(key, flags.bools)
- && !checkAllAliases(key, flags.counts)) {
- setArg(key, next)
- i++
- } else if (/^(true|false)$/.test(next)) {
- setArg(key, next)
- i++
- } else {
- setArg(key, defaultForType(guessType(key, flags)))
- }
- }
-
- // dot-notation flag seperated by '='.
- } else if (arg.match(/^-.\..+=/)) {
- m = arg.match(/^-([^=]+)=([\s\S]*)$/)
- setArg(m[1], m[2])
-
- // dot-notation flag seperated by space.
- } else if (arg.match(/^-.\..+/)) {
- next = args[i + 1]
- key = arg.match(/^-(.\..+)/)[1]
-
- if (next !== undefined && !next.match(/^-/)
- && !checkAllAliases(key, flags.bools)
- && !checkAllAliases(key, flags.counts)) {
- setArg(key, next)
- i++
- } else {
- setArg(key, defaultForType(guessType(key, flags)))
- }
- } else if (arg.match(/^-[^-]+/)) {
- letters = arg.slice(1, -1).split('')
- broken = false
-
- for (var j = 0; j < letters.length; j++) {
- next = arg.slice(j + 2)
-
- if (letters[j + 1] && letters[j + 1] === '=') {
- 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
- break
- }
-
- if (next === '-') {
- setArg(letters[j], next)
- continue
- }
-
- if (/[A-Za-z]/.test(letters[j])
- && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
- setArg(letters[j], next)
- broken = true
- break
- }
-
- if (letters[j + 1] && letters[j + 1].match(/\W/)) {
- setArg(letters[j], arg.slice(j + 2))
- broken = true
- break
- } else {
- setArg(letters[j], defaultForType(guessType(letters[j], flags)))
- }
- }
-
- key = arg.slice(-1)[0]
-
- 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 {
- if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1])
- && !checkAllAliases(key, flags.bools)
- && !checkAllAliases(key, flags.counts)) {
- setArg(key, args[i + 1])
- i++
- } else if (args[i + 1] && /true|false/.test(args[i + 1])) {
- setArg(key, args[i + 1])
- i++
- } else {
- setArg(key, defaultForType(guessType(key, flags)))
- }
- }
- }
- } else {
- argv._.push(
- flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
- )
- }
- }
-
- setConfig(argv)
- applyDefaultsAndAliases(argv, aliases, defaults)
-
- Object.keys(flags.counts).forEach(function (key) {
- setArg(key, defaults[key])
- })
-
- notFlags.forEach(function (key) {
- argv._.push(key)
- })
-
- // how many arguments should we consume, based
- // on the nargs option?
- function eatNargs (i, key, args) {
- var toEat = checkAllAliases(key, opts.narg)
-
- if (args.length - (i + 1) < toEat) throw Error('not enough arguments following: ' + key)
-
- for (var ii = i + 1; ii < (toEat + i + 1); ii++) {
- setArg(key, args[ii])
- }
-
- return (i + toEat)
- }
-
- // 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) {
- // handle parsing boolean arguments --foo=true --bar false.
- if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
- if (typeof val === 'string') val = val === 'true'
- }
-
- if (/-/.test(key) && !(aliases[key] && aliases[key].length)) {
- var c = camelCase(key)
- aliases[key] = [c]
- newAliases[c] = true
- }
-
- var value = !checkAllAliases(key, flags.strings) && isNumber(val) ? Number(val) : val
-
- if (checkAllAliases(key, flags.counts)) {
- value = increment
- }
-
- var splitKey = key.split('.')
- setKey(argv, splitKey, value)
-
- ;(aliases[splitKey[0]] || []).forEach(function (x) {
- x = x.split('.')
-
- // handle populating dot notation for both
- // the key and its aliases.
- if (splitKey.length > 1) {
- var a = [].concat(splitKey)
- a.shift() // nuke the old key.
- x = x.concat(a)
- }
-
- setKey(argv, x, value)
- })
-
- var keys = [key].concat(aliases[key] || [])
- for (var i = 0, l = keys.length; i < l; i++) {
- if (flags.normalize[keys[i]]) {
- keys.forEach(function (key) {
- argv.__defineSetter__(key, function (v) {
- val = path.normalize(v)
- })
-
- argv.__defineGetter__(key, function () {
- return typeof val === 'string' ?
- path.normalize(val) : val
- })
- })
- break
- }
- }
- }
-
- // set args from config.json file, this should be
- // applied last so that defaults can be applied.
- function setConfig (argv) {
- var configLookup = {}
-
- // expand defaults/aliases, in-case any happen to reference
- // the config.json file.
- applyDefaultsAndAliases(configLookup, aliases, defaults)
-
- Object.keys(flags.configs).forEach(function (configKey) {
- var configPath = argv[configKey] || configLookup[configKey]
- if (configPath) {
- try {
- var config = require(path.resolve(process.cwd(), configPath))
-
- Object.keys(config).forEach(function (key) {
- // setting arguments via CLI takes precedence over
- // values within the config file.
- if (argv[key] === undefined) {
- delete argv[key]
- setArg(key, config[key])
- }
- })
- } catch (ex) {
- throw Error('invalid json config file: ' + configPath)
- }
- }
- })
- }
-
- function applyDefaultsAndAliases (obj, aliases, defaults) {
- Object.keys(defaults).forEach(function (key) {
- if (!hasKey(obj, key.split('.'))) {
- setKey(obj, key.split('.'), defaults[key])
-
- ;(aliases[key] || []).forEach(function (x) {
- setKey(obj, x.split('.'), defaults[key])
- })
- }
- })
- }
-
- function hasKey (obj, keys) {
- var o = obj
- keys.slice(0, -1).forEach(function (key) {
- o = (o[key] || {})
- })
-
- var key = keys[keys.length - 1]
- return key in o
- }
-
- function setKey (obj, keys, value) {
- var o = obj
- keys.slice(0, -1).forEach(function (key) {
- if (o[key] === undefined) o[key] = {}
- o = o[key]
- })
-
- var key = keys[keys.length - 1]
- if (value === increment) {
- o[key] = increment(o[key])
- } else if (o[key] === undefined && checkAllAliases(key, flags.arrays)) {
- o[key] = Array.isArray(value) ? value : [value]
- } else if (o[key] === undefined || typeof o[key] === 'boolean') {
- o[key] = value
- } else if (Array.isArray(o[key])) {
- o[key].push(value)
- } else {
- o[key] = [ o[key], value ]
- }
- }
-
- // extend the aliases list with inferred aliases.
- function extendAliases (obj) {
- Object.keys(obj || {}).forEach(function (key) {
- aliases[key] = [].concat(opts.alias[key] || [])
- // For "--option-name", also set argv.optionName
- aliases[key].concat(key).forEach(function (x) {
- if (/-/.test(x)) {
- var c = camelCase(x)
- aliases[key].push(c)
- newAliases[c] = true
- }
- })
- aliases[key].forEach(function (x) {
- aliases[x] = [key].concat(aliases[key].filter(function (y) {
- return x !== y
- }))
- })
- })
- }
-
- // check if a flag is set for any of a key's aliases.
- function checkAllAliases (key, flag) {
- var isSet = false,
- toCheck = [].concat(aliases[key] || [], key)
-
- toCheck.forEach(function (key) {
- if (flag[key]) isSet = flag[key]
- })
-
- return isSet
- }
-
- // return a default value, given the type of a flag.,
- // e.g., key of type 'string' will default to '', rather than 'true'.
- function defaultForType (type) {
- var def = {
- boolean: true,
- string: '',
- array: []
- }
-
- return def[type]
- }
-
- // given a flag, enforce a default type.
- function guessType (key, flags) {
- var type = 'boolean'
-
- if (flags.strings && flags.strings[key]) type = 'string'
- else if (flags.arrays && flags.arrays[key]) type = 'array'
-
- return type
- }
-
- function isNumber (x) {
- if (typeof x === 'number') return true
- if (/^0x[0-9a-f]+$/i.test(x)) return true
- return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x)
- }
-
- return {
- argv: argv,
- aliases: aliases,
- newAliases: newAliases
- }
-}
diff --git a/tools/eslint/node_modules/yargs/lib/usage.js b/tools/eslint/node_modules/yargs/lib/usage.js
deleted file mode 100644
index 8cfe9dd0c3..0000000000
--- a/tools/eslint/node_modules/yargs/lib/usage.js
+++ /dev/null
@@ -1,314 +0,0 @@
-// this file handles outputting usage instructions,
-// failures, etc. keeps logging in one place.
-var cliui = require('cliui'),
- decamelize = require('decamelize'),
- wsize = require('window-size')
-
-module.exports = function (yargs) {
- var self = {}
-
- // methods for ouputting/building failure message.
- var fails = []
- self.failFn = function (f) {
- fails.push(f)
- }
-
- var failMessage = null
- var showHelpOnFail = true
- self.showHelpOnFail = function (enabled, message) {
- if (typeof enabled === 'string') {
- message = enabled
- enabled = true
- } else if (typeof enabled === 'undefined') {
- enabled = true
- }
- failMessage = message
- showHelpOnFail = enabled
- return self
- }
-
- self.fail = function (msg) {
- if (fails.length) {
- fails.forEach(function (f) {
- f(msg)
- })
- } else {
- if (showHelpOnFail) yargs.showHelp('error')
- if (msg) console.error(msg)
- if (failMessage) {
- if (msg) console.error('')
- console.error(failMessage)
- }
- if (yargs.getExitProcess()) {
- process.exit(1)
- } else {
- throw new Error(msg)
- }
- }
- }
-
- // methods for ouputting/building help (usage) message.
- var usage
- self.usage = function (msg) {
- usage = msg
- }
-
- var examples = []
- self.example = function (cmd, description) {
- examples.push([cmd, description || ''])
- }
-
- var commands = []
- self.command = function (cmd, description) {
- commands.push([cmd, description || ''])
- }
- self.getCommands = function () {
- return commands
- }
-
- var descriptions = {}
- self.describe = function (key, desc) {
- if (typeof key === 'object') {
- Object.keys(key).forEach(function (k) {
- self.describe(k, key[k])
- })
- } else {
- descriptions[key] = desc
- }
- }
- self.getDescriptions = function () {
- return descriptions
- }
-
- var epilog
- self.epilog = function (msg) {
- epilog = msg
- }
-
- var wrap = windowWidth()
- self.wrap = function (cols) {
- wrap = cols
- }
-
- self.help = function () {
- normalizeAliases()
-
- var demanded = yargs.getDemanded(),
- options = yargs.getOptions(),
- keys = Object.keys(
- Object.keys(descriptions)
- .concat(Object.keys(demanded))
- .concat(Object.keys(options.default))
- .reduce(function (acc, key) {
- if (key !== '_') acc[key] = true
- return acc
- }, {})
- ),
- ui = cliui({
- width: wrap,
- wrap: !!wrap
- })
-
- // the usage string.
- if (usage) {
- var u = usage.replace(/\$0/g, yargs.$0)
- ui.div(u + '\n')
- }
-
- // your application's commands, i.e., non-option
- // arguments populated in '_'.
- if (commands.length) {
- ui.div('Commands:')
-
- commands.forEach(function (command) {
- ui.div(
- {text: command[0], padding: [0, 2, 0, 2], width: maxWidth(commands) + 4},
- {text: command[1]}
- )
- })
-
- ui.div()
- }
-
- // the options table.
- var aliasKeys = (Object.keys(options.alias) || [])
- .concat(Object.keys(yargs.parsed.newAliases) || [])
-
- keys = keys.filter(function (key) {
- return !yargs.parsed.newAliases[key] && aliasKeys.every(function (alias) {
- return (options.alias[alias] || []).indexOf(key) === -1
- })
- })
-
- var switches = keys.reduce(function (acc, key) {
- acc[key] = [ key ].concat(options.alias[key] || [])
- .map(function (sw) {
- return (sw.length > 1 ? '--' : '-') + sw
- })
- .join(', ')
-
- return acc
- }, {})
-
- if (keys.length) {
- ui.div('Options:')
-
- keys.forEach(function (key) {
- var kswitch = switches[key]
- var desc = descriptions[key] || ''
- var type = null
-
- 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]'
-
- var extra = [
- type,
- demanded[key] ? '[required]' : null,
- defaultString(options.default[key], options.defaultDescription[key])
- ].filter(Boolean).join(' ')
-
- ui.span(
- {text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches) + 4},
- desc
- )
-
- if (extra) ui.div({text: extra, padding: [0, 0, 0, 2], align: 'right'})
- else ui.div()
- })
-
- ui.div()
- }
-
- // describe some common use-cases for your application.
- if (examples.length) {
- ui.div('Examples:')
-
- examples.forEach(function (example) {
- example[0] = example[0].replace(/\$0/g, yargs.$0)
- })
-
- examples.forEach(function (example) {
- ui.div(
- {text: example[0], padding: [0, 2, 0, 2], width: maxWidth(examples) + 4},
- example[1]
- )
- })
-
- ui.div()
- }
-
- // the usage string.
- if (epilog) {
- var e = epilog.replace(/\$0/g, yargs.$0)
- ui.div(e + '\n')
- }
-
- return ui.toString()
- }
-
- // return the maximum width of a string
- // in the left-hand column of a table.
- function maxWidth (table) {
- var width = 0
-
- // table might be of the form [leftColumn],
- // or {key: leftColumn}}
- if (!Array.isArray(table)) {
- table = Object.keys(table).map(function (key) {
- return [table[key]]
- })
- }
-
- table.forEach(function (v) {
- width = Math.max(v[0].length, width)
- })
-
- // if we've enabled 'wrap' we should limit
- // the max-width of the left-column.
- if (wrap) width = Math.min(width, parseInt(wrap * 0.5, 10))
-
- return width
- }
-
- // 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) {
- level = level || 'error'
- console[level](self.help())
- }
-
- self.functionDescription = function (fn, defaultDescription) {
- if (defaultDescription) {
- return defaultDescription
- }
- var description = fn.name ? decamelize(fn.name, '-') : 'generated-value'
- return ['(', description, ')'].join('')
- }
-
- // format the default-value-string displayed in
- // the right-hand column.
- function defaultString (value, defaultDescription) {
- var string = '[default: '
-
- if (value === undefined) return null
-
- if (defaultDescription) {
- string += defaultDescription
- } else {
- switch (typeof value) {
- case 'string':
- string += JSON.stringify(value)
- break
- case 'object':
- string += JSON.stringify(value)
- break
- default:
- string += value
- }
- }
-
- return string + ']'
- }
-
- // guess the width of the console window, max-width 80.
- function windowWidth () {
- return wsize.width ? Math.min(80, wsize.width) : null
- }
-
- // logic for displaying application version.
- var version = null
- self.version = function (ver, opt, msg) {
- version = ver
- }
-
- self.showVersion = function () {
- if (typeof version === 'function') console.log(version())
- else console.log(version)
- }
-
- return self
-}
diff --git a/tools/eslint/node_modules/yargs/lib/validation.js b/tools/eslint/node_modules/yargs/lib/validation.js
deleted file mode 100644
index 19afe94015..0000000000
--- a/tools/eslint/node_modules/yargs/lib/validation.js
+++ /dev/null
@@ -1,196 +0,0 @@
-// validation-type-stuff, missing params,
-// bad implications, custom checks.
-module.exports = function (yargs, usage) {
- var self = {}
-
- // validate appropriate # of non-option
- // arguments were provided, i.e., '_'.
- self.nonOptionCount = function (argv) {
- var demanded = yargs.getDemanded()
-
- if (demanded._ && argv._.length < demanded._.count) {
- if (demanded._.msg !== undefined) {
- usage.fail(demanded._.msg)
- } else {
- usage.fail('Not enough non-option arguments: got '
- + argv._.length + ', need at least ' + demanded._.count
- )
- }
- }
- }
-
- // make sure that any args that require an
- // value (--foo=bar), have a value.
- self.missingArgumentValue = function (argv) {
- var options = yargs.getOptions(),
- defaultValues = [true, false, '']
-
- if (options.requiresArg.length > 0) {
- var missingRequiredArgs = []
-
- options.requiresArg.forEach(function (key) {
- var value = argv[key]
-
- // 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)
- }
- })
-
- if (missingRequiredArgs.length === 1) {
- usage.fail('Missing argument value: ' + missingRequiredArgs[0])
- } else if (missingRequiredArgs.length > 1) {
- var message = 'Missing argument values: ' + missingRequiredArgs.join(', ')
- usage.fail(message)
- }
- }
- }
-
- // make sure all the required arguments are present.
- self.requiredArguments = function (argv) {
- var demanded = yargs.getDemanded(),
- missing = null
-
- Object.keys(demanded).forEach(function (key) {
- if (!argv.hasOwnProperty(key)) {
- missing = missing || {}
- missing[key] = demanded[key]
- }
- })
-
- if (missing) {
- var customMsgs = []
- Object.keys(missing).forEach(function (key) {
- var msg = missing[key].msg
- if (msg && customMsgs.indexOf(msg) < 0) {
- customMsgs.push(msg)
- }
- })
-
- var customMsg = customMsgs.length ? '\n' + customMsgs.join('\n') : ''
- usage.fail('Missing required arguments: ' + Object.keys(missing).join(', ') + customMsg)
- }
- }
-
- // check for unknown arguments (strict-mode).
- self.unknownArguments = function (argv, aliases) {
- var descriptions = usage.getDescriptions(),
- demanded = yargs.getDemanded(),
- unknown = [],
- aliasLookup = {}
-
- Object.keys(aliases).forEach(function (key) {
- aliases[key].forEach(function (alias) {
- aliasLookup[alias] = key
- })
- })
-
- Object.keys(argv).forEach(function (key) {
- if (key !== '$0' && key !== '_' &&
- !descriptions.hasOwnProperty(key) &&
- !demanded.hasOwnProperty(key) &&
- !aliasLookup.hasOwnProperty(key)) {
- unknown.push(key)
- }
- })
-
- if (unknown.length === 1) {
- usage.fail('Unknown argument: ' + unknown[0])
- } else if (unknown.length > 1) {
- usage.fail('Unknown arguments: ' + unknown.join(', '))
- }
- }
-
- // custom checks, added using the `check` option on yargs.
- var checks = []
- self.check = function (f) {
- checks.push(f)
- }
-
- self.customChecks = function (argv, aliases) {
- checks.forEach(function (f) {
- try {
- var result = f(argv, aliases)
- if (!result) {
- usage.fail('Argument check failed: ' + f.toString())
- } else if (typeof result === 'string') {
- usage.fail(result)
- }
- } catch (err) {
- usage.fail(err.message ? err.message : err)
- }
- })
- }
-
- // check implications, argument foo implies => argument bar.
- var implied = {}
- self.implies = function (key, value) {
- if (typeof key === 'object') {
- Object.keys(key).forEach(function (k) {
- self.implies(k, key[k])
- })
- } else {
- implied[key] = value
- }
- }
- self.getImplied = function () {
- return implied
- }
-
- self.implications = function (argv) {
- var implyFail = []
-
- Object.keys(implied).forEach(function (key) {
- var num,
- origKey = key,
- value = implied[key]
-
- // convert string '1' to number 1
- num = Number(key)
- key = isNaN(num) ? key : num
-
- if (typeof key === 'number') {
- // check length of argv._
- key = argv._.length >= key
- } else if (key.match(/^--no-.+/)) {
- // check if key doesn't exist
- key = key.match(/^--no-(.+)/)[1]
- key = !argv[key]
- } else {
- // check if key exists
- key = argv[key]
- }
-
- num = Number(value)
- value = isNaN(num) ? value : num
-
- if (typeof value === 'number') {
- value = argv._.length >= value
- } else if (value.match(/^--no-.+/)) {
- value = value.match(/^--no-(.+)/)[1]
- value = !argv[value]
- } else {
- value = argv[value]
- }
-
- if (key && !value) {
- implyFail.push(origKey)
- }
- })
-
- if (implyFail.length) {
- var msg = 'Implications failed:\n'
-
- implyFail.forEach(function (key) {
- msg += (' ' + key + ' -> ' + implied[key])
- })
-
- usage.fail(msg)
- }
- }
-
- return self
-}
diff --git a/tools/eslint/node_modules/yargs/package.json b/tools/eslint/node_modules/yargs/package.json
deleted file mode 100644
index 2281a6b0fe..0000000000
--- a/tools/eslint/node_modules/yargs/package.json
+++ /dev/null
@@ -1,145 +0,0 @@
-{
- "_args": [
- [
- "yargs@~3.10.0",
- "/Users/mzasso/git/forks/node/node_modules/eslint/node_modules/uglify-js"
- ]
- ],
- "_from": "yargs@>=3.10.0 <3.11.0",
- "_id": "yargs@3.10.0",
- "_inCache": true,
- "_installable": true,
- "_location": "/eslint/yargs",
- "_nodeVersion": "2.0.2",
- "_npmUser": {
- "email": "ben@npmjs.com",
- "name": "bcoe"
- },
- "_npmVersion": "2.9.0",
- "_phantomChildren": {},
- "_requested": {
- "name": "yargs",
- "raw": "yargs@~3.10.0",
- "rawSpec": "~3.10.0",
- "scope": null,
- "spec": ">=3.10.0 <3.11.0",
- "type": "range"
- },
- "_requiredBy": [
- "/eslint/uglify-js"
- ],
- "_resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",
- "_shasum": "f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1",
- "_shrinkwrap": null,
- "_spec": "yargs@~3.10.0",
- "_where": "/Users/mzasso/git/forks/node/node_modules/eslint/node_modules/uglify-js",
- "author": {
- "email": "Alex.Ford@CodeTunnel.com",
- "name": "Alex Ford",
- "url": "http://CodeTunnel.com"
- },
- "bugs": {
- "url": "https://github.com/bcoe/yargs/issues"
- },
- "contributors": [
- {
- "name": "Benjamin Coe",
- "email": "ben@npmjs.com",
- "url": "https://github.com/bcoe"
- },
- {
- "name": "Chris Needham",
- "email": "chris@chrisneedham.com",
- "url": "http://chrisneedham.com"
- },
- {
- "name": "James Nylen",
- "email": "jnylen@gmail.com",
- "url": "https://github.com/nylen"
- },
- {
- "name": "Benjamin Horsleben",
- "url": "https://github.com/fizker"
- },
- {
- "name": "Lin Clark",
- "url": "https://github.com/linclark"
- }
- ],
- "dependencies": {
- "camelcase": "^1.0.2",
- "cliui": "^2.1.0",
- "decamelize": "^1.0.0",
- "window-size": "0.1.0"
- },
- "description": "Light-weight option parsing with an argv hash. No optstrings attached.",
- "devDependencies": {
- "chai": "^2.2.0",
- "coveralls": "^2.11.2",
- "hashish": "0.0.4",
- "mocha": "^2.2.1",
- "nyc": "^2.2.1",
- "standard": "^3.11.1"
- },
- "directories": {},
- "dist": {
- "shasum": "f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1",
- "tarball": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz"
- },
- "engine": {
- "node": ">=0.4"
- },
- "files": [
- "LICENSE",
- "completion.sh.hbs",
- "index.js",
- "lib"
- ],
- "gitHead": "491e6b10e46485a31504e6a1ef21450dff425030",
- "homepage": "https://github.com/bcoe/yargs#readme",
- "keywords": [
- "args",
- "argument",
- "cli",
- "command",
- "option",
- "parser",
- "parsing"
- ],
- "license": "MIT",
- "main": "./index.js",
- "maintainers": [
- {
- "name": "chevex",
- "email": "alex.ford@codetunnel.com"
- },
- {
- "name": "bcoe",
- "email": "bencoe@gmail.com"
- },
- {
- "name": "nylen",
- "email": "jnylen@gmail.com"
- }
- ],
- "name": "yargs",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+ssh://git@github.com/bcoe/yargs.git"
- },
- "scripts": {
- "coverage": "nyc report --reporter=text-lcov | coveralls",
- "test": "standard && nyc mocha --check-leaks && nyc report"
- },
- "standard": {
- "globals": [
- "it"
- ],
- "ignore": [
- "**/example/**"
- ]
- },
- "version": "3.10.0"
-}