diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..8f7d6654a
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+# EditorConfig is awesome: http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 2
+tab_width = 2
+# trim_trailing_whitespace = true
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 000000000..9acfc3c48
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,8 @@
+{
+ "extends": "standard",
+ "rules": {
+ "one-var": "off",
+ "semi": ["error", "always"],
+ "space-before-function-paren": ["error", "never"]
+ }
+}
diff --git a/.gitignore b/.gitignore
index 70687964d..979dd95fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
node_modules
*.sock
.idea
+.vscode/
diff --git a/.travis.yml b/.travis.yml
old mode 100755
new mode 100644
index 7dcfc0812..2783c4f8f
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,13 +1,12 @@
language: node_js
sudo: false
node_js:
- - "0.6"
- - "0.8"
- - "0.10"
- - "0.12"
- - "io.js"
- - "2"
- - "3"
- - "4"
- - "6"
- - "node"
+- "6"
+- "8"
+- "10"
+cache:
+ directories:
+ - "node_modules"
+script:
+- npm run lint
+- npm test
diff --git a/History.md b/CHANGELOG.md
similarity index 58%
rename from History.md
rename to CHANGELOG.md
index 1b47439cb..953ef21b4 100644
--- a/History.md
+++ b/CHANGELOG.md
@@ -1,4 +1,151 @@
+2.20.0 / 2019-04-02
+==================
+
+ * fix: resolve symbolic links completely when hunting for subcommands (#935)
+ * Update index.d.ts (#930)
+ * Update Readme.md (#924)
+ * Remove --save option as it isn't required anymore (#918)
+ * Add link to the license file (#900)
+ * Added example of receiving args from options (#858)
+ * Added missing semicolon (#882)
+ * Add extension to .eslintrc (#876)
+
+2.19.0 / 2018-10-02
+==================
+
+ * Removed newline after Options and Commands headers (#864)
+ * Bugfix - Error output (#862)
+ * Fix to change default value to string (#856)
+
+2.18.0 / 2018-09-07
+==================
+
+ * Standardize help output (#853)
+ * chmod 644 travis.yml (#851)
+ * add support for execute typescript subcommand via ts-node (#849)
+
+2.17.1 / 2018-08-07
+==================
+
+ * Fix bug in command emit (#844)
+
+2.17.0 / 2018-08-03
+==================
+
+ * fixed newline output after help information (#833)
+ * Fix to emit the action even without command (#778)
+ * npm update (#823)
+
+2.16.0 / 2018-06-29
+==================
+
+ * Remove Makefile and `test/run` (#821)
+ * Make 'npm test' run on Windows (#820)
+ * Add badge to display install size (#807)
+ * chore: cache node_modules (#814)
+ * chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
+ * fixed typo in readme (#812)
+ * Fix types (#804)
+ * Update eslint to resolve vulnerabilities in lodash (#799)
+ * updated readme with custom event listeners. (#791)
+ * fix tests (#794)
+
+2.15.0 / 2018-03-07
+==================
+
+ * Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
+ * Arguments description
+
+2.14.1 / 2018-02-07
+==================
+
+ * Fix typing of help function
+
+2.14.0 / 2018-02-05
+==================
+
+ * only register the option:version event once
+ * Fixes issue #727: Passing empty string for option on command is set to undefined
+ * enable eqeqeq rule
+ * resolves #754 add linter configuration to project
+ * resolves #560 respect custom name for version option
+ * document how to override the version flag
+ * document using options per command
+
+2.13.0 / 2018-01-09
+==================
+
+ * Do not print default for --no-
+ * remove trailing spaces in command help
+ * Update CI's Node.js to LTS and latest version
+ * typedefs: Command and Option types added to commander namespace
+
+2.12.2 / 2017-11-28
+==================
+
+ * fix: typings are not shipped
+
+2.12.1 / 2017-11-23
+==================
+
+ * Move @types/node to dev dependency
+
+2.12.0 / 2017-11-22
+==================
+
+ * add attributeName() method to Option objects
+ * Documentation updated for options with --no prefix
+ * typings: `outputHelp` takes a string as the first parameter
+ * typings: use overloads
+ * feat(typings): update to match js api
+ * Print default value in option help
+ * Fix translation error
+ * Fail when using same command and alias (#491)
+ * feat(typings): add help callback
+ * fix bug when description is add after command with options (#662)
+ * Format js code
+ * Rename History.md to CHANGELOG.md (#668)
+ * feat(typings): add typings to support TypeScript (#646)
+ * use current node
+
+2.11.0 / 2017-07-03
+==================
+
+ * Fix help section order and padding (#652)
+ * feature: support for signals to subcommands (#632)
+ * Fixed #37, --help should not display first (#447)
+ * Fix translation errors. (#570)
+ * Add package-lock.json
+ * Remove engines
+ * Upgrade package version
+ * Prefix events to prevent conflicts between commands and options (#494)
+ * Removing dependency on graceful-readlink
+ * Support setting name in #name function and make it chainable
+ * Add .vscode directory to .gitignore (Visual Studio Code metadata)
+ * Updated link to ruby commander in readme files
+
+2.10.0 / 2017-06-19
+==================
+
+ * Update .travis.yml. drop support for older node.js versions.
+ * Fix require arguments in README.md
+ * On SemVer you do not start from 0.0.1
+ * Add missing semi colon in readme
+ * Add save param to npm install
+ * node v6 travis test
+ * Update Readme_zh-CN.md
+ * Allow literal '--' to be passed-through as an argument
+ * Test subcommand alias help
+ * link build badge to master branch
+ * Support the alias of Git style sub-command
+ * added keyword commander for better search result on npm
+ * Fix Sub-Subcommands
+ * test node.js stable
+ * Fixes TypeError when a command has an option called `--description`
+ * Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.
+ * Add chinese Readme file
+
2.9.0 / 2015-10-13
==================
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 007462553..000000000
--- a/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-
-TESTS = $(shell find test/test.*.js)
-
-test:
- @./test/run $(TESTS)
-
-.PHONY: test
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
index 821d791c2..3c00815cb 100644
--- a/Readme.md
+++ b/Readme.md
@@ -3,20 +3,20 @@
[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js)
[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
-[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
-[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)
+[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)
- The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/tj/commander).
+ The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander).
[API documentation](http://tj.github.com/commander.js/)
## Installation
- $ npm install commander --save
+ $ npm install commander
## Option parsing
- Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
+Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
```js
#!/usr/bin/env node
@@ -28,7 +28,7 @@
var program = require('commander');
program
- .version('0.0.1')
+ .version('0.1.0')
.option('-p, --peppers', 'Add peppers')
.option('-P, --pineapple', 'Add pineapple')
.option('-b, --bbq-sauce', 'Add bbq sauce')
@@ -42,8 +42,76 @@ if (program.bbqSauce) console.log(' - bbq');
console.log(' - %s cheese', program.cheese);
```
- Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('commander');
+
+program
+ .option('--no-sauce', 'Remove sauce')
+ .parse(process.argv);
+
+console.log('you ordered a pizza');
+if (program.sauce) console.log(' with sauce');
+else console.log(' without sauce');
+```
+
+To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs.
+
+e.g. ```.option('-m --myarg [myVar]', 'my super cool description')```
+
+Then to access the input if it was passed in.
+
+e.g. ```var myInput = program.myarg```
+
+**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in.
+
+
+## Version option
+
+Calling the `version` implicitly adds the `-V` and `--version` options to the command.
+When either of these options is present, the command prints the version number and exits.
+
+ $ ./examples/pizza -V
+ 0.0.1
+
+If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method.
+
+```js
+program
+ .version('0.0.1', '-v, --version')
+```
+
+The version flags can be named anything, but the long option is required.
+
+## Command-specific options
+
+You can attach options to a command.
+
+```js
+#!/usr/bin/env node
+
+var program = require('commander');
+
+program
+ .command('rm
')
+ .option('-r, --recursive', 'Remove recursively')
+ .action(function (dir, cmd) {
+ console.log('remove ' + dir + (cmd.recursive ? ' recursively' : ''))
+ })
+
+program.parse(process.argv)
+```
+
+A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated.
## Coercion
@@ -66,7 +134,7 @@ function increaseVerbosity(v, total) {
}
program
- .version('0.0.1')
+ .version('0.1.0')
.usage('[options] ')
.option('-i, --integer ', 'An integer argument', parseInt)
.option('-f, --float ', 'A float argument', parseFloat)
@@ -91,11 +159,11 @@ console.log(' args: %j', program.args);
## Regular Expression
```js
program
- .version('0.0.1')
+ .version('0.1.0')
.option('-s --size ', 'Pizza size', /^(large|medium|small)$/i, 'medium')
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
.parse(process.argv);
-
+
console.log(' size: %j', program.size);
console.log(' drink: %j', program.drink);
```
@@ -115,7 +183,7 @@ console.log(' drink: %j', program.drink);
var program = require('commander');
program
- .version('0.0.1')
+ .version('0.1.0')
.command('rmdir [otherDirs...]')
.action(function (dir, otherDirs) {
console.log('rmdir %s', dir);
@@ -137,10 +205,10 @@ program.parse(process.argv);
```js
#!/usr/bin/env node
-var program = require('../');
+var program = require('commander');
program
- .version('0.0.1')
+ .version('0.1.0')
.arguments(' [env]')
.action(function (cmd, env) {
cmdValue = cmd;
@@ -162,10 +230,10 @@ Angled brackets (e.g. ``) indicate required input. Square brackets (e.g. `[
```js
// file: ./examples/pm
-var program = require('..');
+var program = require('commander');
program
- .version('0.0.1')
+ .version('0.1.0')
.command('install [name]', 'install one or more packages')
.command('search [query]', 'search with optional query')
.command('list', 'list packages installed', {isDefault: true})
@@ -175,7 +243,7 @@ program
When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
-Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the option from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
+Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
@@ -190,22 +258,19 @@ You can enable `--harmony` option in two ways:
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
```
- $ ./examples/pizza --help
-
- Usage: pizza [options]
-
- An application for pizzas ordering
-
- Options:
+$ ./examples/pizza --help
+Usage: pizza [options]
- -h, --help output usage information
- -V, --version output the version number
- -p, --peppers Add peppers
- -P, --pineapple Add pineapple
- -b, --bbq Add bbq sauce
- -c, --cheese Add the specified type of cheese [marble]
- -C, --no-cheese You do not want any cheese
+An application for pizzas ordering
+Options:
+ -h, --help output usage information
+ -V, --version output the version number
+ -p, --peppers Add peppers
+ -P, --pineapple Add pineapple
+ -b, --bbq Add bbq sauce
+ -c, --cheese Add the specified type of cheese [marble]
+ -C, --no-cheese You do not want any cheese
```
## Custom help
@@ -213,7 +278,7 @@ You can enable `--harmony` option in two ways:
You can display arbitrary `-h, --help` information
by listening for "--help". Commander will automatically
exit once you are done so that the remainder of your program
- does not execute causing undesired behaviours, for example
+ does not execute causing undesired behaviors, for example
in the following executable "stuff" will not output when
`--help` is used.
@@ -227,7 +292,7 @@ You can enable `--harmony` option in two ways:
var program = require('commander');
program
- .version('0.0.1')
+ .version('0.1.0')
.option('-f, --foo', 'enable some foo')
.option('-b, --bar', 'enable some bar')
.option('-B, --baz', 'enable some baz');
@@ -236,11 +301,10 @@ program
// node's emit() is immediate
program.on('--help', function(){
- console.log(' Examples:');
- console.log('');
- console.log(' $ custom-help --help');
- console.log(' $ custom-help -h');
- console.log('');
+ console.log('')
+ console.log('Examples:');
+ console.log(' $ custom-help --help');
+ console.log(' $ custom-help -h');
});
program.parse(process.argv);
@@ -251,11 +315,9 @@ console.log('stuff');
Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
```
-
Usage: custom-help [options]
Options:
-
-h, --help output usage information
-V, --version output the version number
-f, --foo enable some foo
@@ -263,10 +325,8 @@ Options:
-B, --baz enable some baz
Examples:
-
$ custom-help --help
$ custom-help -h
-
```
## .outputHelp(cb)
@@ -281,13 +341,13 @@ var program = require('commander');
var colors = require('colors');
program
- .version('0.0.1')
+ .version('0.1.0')
.command('getstream [url]', 'get stream URL')
.parse(process.argv);
- if (!process.argv.slice(2).length) {
- program.outputHelp(make_red);
- }
+if (!process.argv.slice(2).length) {
+ program.outputHelp(make_red);
+}
function make_red(txt) {
return colors.red(txt); //display the help text in red on the console
@@ -299,13 +359,29 @@ function make_red(txt) {
Output help information and exit immediately.
Optional callback cb allows post-processing of help text before it is displayed.
+
+## Custom event listeners
+ You can execute custom actions by listening to command and option events.
+
+```js
+program.on('option:verbose', function () {
+ process.env.VERBOSE = this.verbose;
+});
+
+// error on unknown commands
+program.on('command:*', function () {
+ console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
+ process.exit(1);
+});
+```
+
## Examples
```js
var program = require('commander');
program
- .version('0.0.1')
+ .version('0.1.0')
.option('-C, --chdir ', 'change the working directory')
.option('-c, --config ', 'set config path. defaults to ./deploy.conf')
.option('-T, --no-tests', 'ignore test hook');
@@ -328,11 +404,11 @@ program
.action(function(cmd, options){
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
}).on('--help', function() {
- console.log(' Examples:');
- console.log();
- console.log(' $ deploy exec sequential');
- console.log(' $ deploy exec async');
- console.log();
+ console.log('');
+ console.log('Examples:');
+ console.log('');
+ console.log(' $ deploy exec sequential');
+ console.log(' $ deploy exec async');
});
program
@@ -348,5 +424,4 @@ More Demos can be found in the [examples](https://github.com/tj/commander.js/tre
## License
-MIT
-
+[MIT](https://github.com/tj/commander.js/blob/master/LICENSE)
diff --git a/Readme_zh-CN.md b/Readme_zh-CN.md
index 507b88864..febfadd63 100644
--- a/Readme_zh-CN.md
+++ b/Readme_zh-CN.md
@@ -4,9 +4,8 @@
[![Build Status](https://api.travis-ci.org/tj/commander.js.svg)](http://travis-ci.org/tj/commander.js)
[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
-[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
- [node.js](http://nodejs.org) 命令行接口的完整解决方案,灵感来自 Ruby 的 [commander](https://github.com/tj/commander)。
+ [node.js](http://nodejs.org) 命令行接口的完整解决方案,灵感来自 Ruby 的 [commander](https://github.com/commander-rb/commander)。
[API 文档](http://tj.github.com/commander.js/)
@@ -15,7 +14,7 @@
$ npm install commander
## 参数解析
- 定义并使用 commander 的选项功能 `.option()` 方法。作为这些选项的文档,下面的例子会解析来自 `progress.argv` 指定的参数和选项,留下剩余未被选择的参数放到 `program.args` 数组中。
+ `.option()` 方法用来定义带选项的 commander,同时也作为这些选项的文档。下面的例子会解析来自 `process.argv` 指定的参数和选项,没有匹配任何选项的参数将会放到 `program.args` 数组中。
```js
#!/usr/bin/env node
@@ -94,14 +93,14 @@ program
.option('-s --size ', 'Pizza size', /^(large|medium|small)$/i, 'medium')
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
.parse(process.argv);
-
+
console.log(' size: %j', program.size);
console.log(' drink: %j', program.drink);
```
## 可变参数
- 一个命令的最后一个参数可以是可变参数, 并且只能是最后一个参数。为了使参数可变,你需要在参数名后面追加 `...`。 下面是个示例:
+ 一个命令的最后一个参数可以是可变参数, 并且只有最后一个参数可变。为了使参数可变,你需要在参数名后面追加 `...`。 下面是个示例:
```js
#!/usr/bin/env node
@@ -126,9 +125,7 @@ program
program.parse(process.argv);
```
-
- `数组` 是可以用于给可变参数传值的。 这适用于 `program.args` 以及参数传递,以你的行动证明上述。
- 你可以如上所示的去尝试。
+可变参数的值以 `数组` 的形式保存。如上所示,在传递给你的 action 的参数和 `program.args` 中的值都是如此。
## 指定参数的语法
@@ -154,6 +151,7 @@ if (typeof cmdValue === 'undefined') {
console.log('command:', cmdValue);
console.log('environment:', envValue || "no environment given");
```
+尖括号(例如 ``)代表必填输入,方括号(例如 `[env]`)代表可选输入。
## Git 风格的子命令
@@ -169,45 +167,42 @@ program
.parse(process.argv);
```
- 当说明参数调用 `.command()` 时,没有 `.action(callback)` 应调用来处理子命令,否则会出错。这告诉 commander,你要使用单独的可执行文件的子命令,就像 `git(1)` 和其他流行工具一样。
- Commander 将尝试在入口脚本的目录中搜索可执行文件,(像 `./examples/pm`)与名称 `program-command`,像 `pm-install`,`pm-search`。
+当 `.command()` 带有描述参数时,不能采用 `.action(callback)` 来处理子命令,否则会出错。这告诉 commander,你将采用单独的可执行文件作为子命令,就像 `git(1)` 和其他流行的工具一样。
+Commander 将会尝试在入口脚本(例如 `./examples/pm`)的目录中搜索 `program-command` 形式的可执行文件,例如 `pm-install`, `pm-search`。
- 对 `.command()` 的调用,可以传递选项。指定 `opts.noHelp` 为 `true` 将从生成的帮助输出中删除选项。如果没有其他子命令指定,指定 `opts.isDefault` 为 `true` 将运行子命令。
+你可以在调用 `.command()` 时传递选项。指定 `opts.noHelp` 为 `true` 将从生成的帮助输出中剔除该选项。指定 `opts.isDefault` 为 `true` 将会在没有其它子命令指定的情况下,执行该子命令。
- 如果打算全局(--global)安装该命令,请确保可执行文件有适当的模式,如 '755'。
+如果你打算全局安装该命令,请确保可执行文件有对应的权限,例如 `755`。
### `--harmony`
-您可以启用 `--harmoney` 选项在两个方面:
-* 用 `#!/usr/bin/env node --harmony` 在子命令脚本中。注意一些系统版本不支持此模式。
-* 用 `--harmoney` 选项时调用的命令,像 `node --harmony examples/pm publish`。`--harmoney` 选项当产生一个子命令进程时保留选项。
+您可以采用两种方式启用 `--harmony`:
+* 在子命令脚本中加上 `#!/usr/bin/env node --harmony`。注意一些系统版本不支持此模式。
+* 在指令调用时加上 `--harmony` 参数,例如 `node --harmony examples/pm publish`。`--harmony` 选项在开启子进程时会被保留。
## 自动化帮助信息 --help
帮助信息是 commander 基于你的程序自动生成的,下面是 `--help` 生成的帮助信息:
```
- $ ./examples/pizza --help
-
- Usage: pizza [options]
+$ ./examples/pizza --help
+Usage: pizza [options]
- An application for pizzas ordering
-
- Options:
-
- -h, --help output usage information
- -V, --version output the version number
- -p, --peppers Add peppers
- -P, --pineapple Add pineapple
- -b, --bbq Add bbq sauce
- -c, --cheese Add the specified type of cheese [marble]
- -C, --no-cheese You do not want any cheese
+An application for pizzas ordering
+Options:
+ -h, --help output usage information
+ -V, --version output the version number
+ -p, --peppers Add peppers
+ -P, --pineapple Add pineapple
+ -b, --bbq Add bbq sauce
+ -c, --cheese Add the specified type of cheese [marble]
+ -C, --no-cheese You do not want any cheese
```
## 自定义帮助
- 你可以显示任何 `-h, --help` 信息,通过监听 `--help` 。一旦你完成了 Commander 将自动退出,你的程序的其余部分不会展示。例如在下面的 “stuff” 将不会在执行 `--help` 时输出。
+ 你可以通过监听 `--help` 来控制 `-h, --help` 显示任何信息。一旦调用完成, Commander 将自动退出,你的程序的其余部分不会展示。例如在下面的 “stuff” 将不会在执行 `--help` 时输出。
```js
#!/usr/bin/env node
@@ -228,11 +223,10 @@ program
// node's emit() is immediate
program.on('--help', function(){
- console.log(' Examples:');
- console.log('');
- console.log(' $ custom-help --help');
- console.log(' $ custom-help -h');
console.log('');
+ console.log('Examples:');
+ console.log(' $ custom-help --help');
+ console.log(' $ custom-help -h');
});
program.parse(process.argv);
@@ -243,11 +237,9 @@ console.log('stuff');
下列帮助信息是运行 `node script-name.js -h` or `node script-name.js --help` 时输出的:
```
-
Usage: custom-help [options]
Options:
-
-h, --help output usage information
-V, --version output the version number
-f, --foo enable some foo
@@ -255,10 +247,8 @@ Options:
-B, --baz enable some baz
Examples:
-
$ custom-help --help
$ custom-help -h
-
```
## .outputHelp(cb)
@@ -319,11 +309,11 @@ program
.action(function(cmd, options){
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
}).on('--help', function() {
- console.log(' Examples:');
- console.log();
- console.log(' $ deploy exec sequential');
- console.log(' $ deploy exec async');
- console.log();
+ console.log('');
+ console.log('Examples:');
+ console.log('');
+ console.log(' $ deploy exec sequential');
+ console.log(' $ deploy exec async');
});
program
@@ -340,4 +330,3 @@ program.parse(process.argv);
## 许可证
MIT
-
diff --git a/examples/custom-help b/examples/custom-help
index 039e5103d..7260d9cb0 100755
--- a/examples/custom-help
+++ b/examples/custom-help
@@ -16,11 +16,11 @@ program
// node's emit() is immediate
program.on('--help', function(){
- console.log(' Examples:');
console.log('');
- console.log(' $ custom-help --help');
- console.log(' $ custom-help -h');
+ console.log('Examples:');
console.log('');
+ console.log(' $ custom-help --help');
+ console.log(' $ custom-help -h');
});
program.parse(process.argv);
diff --git a/examples/pm b/examples/pm
index baac7816f..2d0506441 100755
--- a/examples/pm
+++ b/examples/pm
@@ -4,6 +4,7 @@ var program = require('..');
program
.version('0.0.1')
+ .description('Fake package manager')
.command('install [name]', 'install one or more packages').alias('i')
.command('search [query]', 'search with optional query').alias('s')
.command('list', 'list packages installed')
diff --git a/index.js b/index.js
index 2fa920107..ad100e1b6 100644
--- a/index.js
+++ b/index.js
@@ -4,12 +4,17 @@
var EventEmitter = require('events').EventEmitter;
var spawn = require('child_process').spawn;
-var readlink = require('graceful-readlink').readlinkSync;
var path = require('path');
var dirname = path.dirname;
var basename = path.basename;
var fs = require('fs');
+/**
+ * Inherit `Command` from `EventEmitter.prototype`.
+ */
+
+require('util').inherits(Command, EventEmitter);
+
/**
* Expose the root command.
*/
@@ -38,9 +43,9 @@ exports.Option = Option;
function Option(flags, description) {
this.flags = flags;
- this.required = ~flags.indexOf('<');
- this.optional = ~flags.indexOf('[');
- this.bool = !~flags.indexOf('-no-');
+ this.required = flags.indexOf('<') >= 0;
+ this.optional = flags.indexOf('[') >= 0;
+ this.bool = flags.indexOf('-no-') === -1;
flags = flags.split(/[ ,|]+/);
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
this.long = flags.shift();
@@ -60,6 +65,18 @@ Option.prototype.name = function() {
.replace('no-', '');
};
+/**
+ * Return option name, in a camelcase format that can be used
+ * as a object attribute key.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Option.prototype.attributeName = function() {
+ return camelcase(this.name());
+};
+
/**
* Check if `arg` matches the short or long flag.
*
@@ -69,7 +86,7 @@ Option.prototype.name = function() {
*/
Option.prototype.is = function(arg) {
- return arg == this.short || arg == this.long;
+ return this.short === arg || this.long === arg;
};
/**
@@ -88,12 +105,6 @@ function Command(name) {
this._name = name || '';
}
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-Command.prototype.__proto__ = EventEmitter.prototype;
-
/**
* Add command `name`.
*
@@ -156,6 +167,10 @@ Command.prototype.__proto__ = EventEmitter.prototype;
*/
Command.prototype.command = function(name, desc, opts) {
+ if (typeof desc === 'object' && desc !== null) {
+ opts = desc;
+ desc = null;
+ }
opts = opts || {};
var args = name.split(/ +/);
var cmd = new Command(args.shift());
@@ -166,7 +181,6 @@ Command.prototype.command = function(name, desc, opts) {
this._execs[cmd._name] = true;
if (opts.isDefault) this.defaultExecutable = cmd._name;
}
-
cmd._noHelp = !!opts.noHelp;
this.commands.push(cmd);
cmd.parseExpectedArgs(args);
@@ -182,7 +196,7 @@ Command.prototype.command = function(name, desc, opts) {
* @api public
*/
-Command.prototype.arguments = function (desc) {
+Command.prototype.arguments = function(desc) {
return this.parseExpectedArgs(desc.split(/ +/));
};
@@ -278,7 +292,7 @@ Command.prototype.action = function(fn) {
if (parsed.args.length) args = parsed.args.concat(args);
self._args.forEach(function(arg, i) {
- if (arg.required && null == args[i]) {
+ if (arg.required && args[i] == null) {
self.missingArgument(arg.name);
} else if (arg.variadic) {
if (i !== self._args.length - 1) {
@@ -302,8 +316,8 @@ Command.prototype.action = function(fn) {
};
var parent = this.parent || this;
var name = parent === this ? '*' : this._name;
- parent.on(name, listener);
- if (this._alias) parent.on(this._alias, listener);
+ parent.on('command:' + name, listener);
+ if (this._alias) parent.on('command:' + this._alias, listener);
return this;
};
@@ -350,39 +364,41 @@ Command.prototype.action = function(fn) {
*
* @param {String} flags
* @param {String} description
- * @param {Function|Mixed} fn or default
- * @param {Mixed} defaultValue
+ * @param {Function|*} [fn] or default
+ * @param {*} [defaultValue]
* @return {Command} for chaining
* @api public
*/
Command.prototype.option = function(flags, description, fn, defaultValue) {
- var self = this
- , option = new Option(flags, description)
- , oname = option.name()
- , name = camelcase(oname);
+ var self = this,
+ option = new Option(flags, description),
+ oname = option.name(),
+ name = option.attributeName();
// default as 3rd arg
- if (typeof fn != 'function') {
+ if (typeof fn !== 'function') {
if (fn instanceof RegExp) {
var regex = fn;
fn = function(val, def) {
var m = regex.exec(val);
return m ? m[0] : def;
- }
- }
- else {
+ };
+ } else {
defaultValue = fn;
fn = null;
}
}
// preassign default value only for --no-*, [optional], or
- if (false == option.bool || option.optional || option.required) {
+ if (!option.bool || option.optional || option.required) {
// when --no-* we make sure default is true
- if (false == option.bool) defaultValue = true;
+ if (!option.bool) defaultValue = true;
// preassign only if we have a default
- if (undefined !== defaultValue) self[name] = defaultValue;
+ if (defaultValue !== undefined) {
+ self[name] = defaultValue;
+ option.defaultValue = defaultValue;
+ }
}
// register the option
@@ -390,23 +406,23 @@ Command.prototype.option = function(flags, description, fn, defaultValue) {
// when it's passed assign the value
// and conditionally invoke the callback
- this.on(oname, function(val) {
+ this.on('option:' + oname, function(val) {
// coercion
- if (null !== val && fn) val = fn(val, undefined === self[name]
- ? defaultValue
- : self[name]);
+ if (val !== null && fn) {
+ val = fn(val, self[name] === undefined ? defaultValue : self[name]);
+ }
// unassigned or bool
- if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
+ if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') {
// if no value, bool true, and we have a default, then use it!
- if (null == val) {
+ if (val == null) {
self[name] = option.bool
? defaultValue || true
: false;
} else {
self[name] = val;
}
- } else if (null !== val) {
+ } else if (val !== null) {
// reassign
self[name] = val;
}
@@ -423,8 +439,8 @@ Command.prototype.option = function(flags, description, fn, defaultValue) {
* @api public
*/
Command.prototype.allowUnknownOption = function(arg) {
- this._allowUnknownOption = arguments.length === 0 || arg;
- return this;
+ this._allowUnknownOption = arguments.length === 0 || arg;
+ return this;
};
/**
@@ -468,7 +484,7 @@ Command.prototype.parse = function(argv) {
})[0];
}
- if (this._execs[name] && typeof this._execs[name] != "function") {
+ if (this._execs[name] && typeof this._execs[name] !== 'function') {
return this.executeSubCommand(argv, args, parsed.unknown);
} else if (aliasCommand) {
// is alias of a subCommand
@@ -496,10 +512,10 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
args = args.concat(unknown);
if (!args.length) this.help();
- if ('help' == args[0] && 1 == args.length) this.help();
+ if (args[0] === 'help' && args.length === 1) this.help();
// --help
- if ('help' == args[0]) {
+ if (args[0] === 'help') {
args[0] = args[1];
args[1] = '--help';
}
@@ -507,28 +523,30 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
// executable
var f = argv[1];
// name of the subcommand, link `pm-install`
- var bin = basename(f, '.js') + '-' + args[0];
-
+ var bin = basename(f, path.extname(f)) + '-' + args[0];
// In case of globally installed, get the base dir where executable
// subcommand file should be located at
- var baseDir
- , link = readlink(f);
+ var baseDir;
- // when symbolink is relative path
- if (link !== f && link.charAt(0) !== '/') {
- link = path.join(dirname(f), link)
- }
- baseDir = dirname(link);
+ var resolvedLink = fs.realpathSync(f);
+
+ baseDir = dirname(resolvedLink);
// prefer local `./` to bin in the $PATH
var localBin = path.join(baseDir, bin);
- // whether bin file is a js script with explicit `.js` extension
+ // whether bin file is a js script with explicit `.js` or `.ts` extension
var isExplicitJS = false;
if (exists(localBin + '.js')) {
bin = localBin + '.js';
isExplicitJS = true;
+ } else if (exists(localBin + '.ts')) {
+ bin = localBin + '.ts';
+ isExplicitJS = true;
+ } else if (exists(localBin + '.mjs')) {
+ bin = localBin + '.mjs';
+ isExplicitJS = true;
} else if (exists(localBin)) {
bin = localBin;
}
@@ -542,7 +560,7 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
// add executable arguments to spawn
args = (process.execArgv || []).concat(args);
- proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] });
+ proc = spawn(process.argv[0], args, { stdio: 'inherit', customFds: [0, 1, 2] });
} else {
proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] });
}
@@ -550,15 +568,23 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
args.unshift(bin);
// add executable arguments to spawn
args = (process.execArgv || []).concat(args);
- proc = spawn(process.execPath, args, { stdio: 'inherit'});
+ proc = spawn(process.execPath, args, { stdio: 'inherit' });
}
+ var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];
+ signals.forEach(function(signal) {
+ process.on(signal, function() {
+ if (proc.killed === false && proc.exitCode === null) {
+ proc.kill(signal);
+ }
+ });
+ });
proc.on('close', process.exit.bind(process));
proc.on('error', function(err) {
- if (err.code == "ENOENT") {
- console.error('\n %s(1) does not exist, try --help\n', bin);
- } else if (err.code == "EACCES") {
- console.error('\n %s(1) not executable. try chmod or run with root\n', bin);
+ if (err.code === 'ENOENT') {
+ console.error('error: %s(1) does not exist, try --help', bin);
+ } else if (err.code === 'EACCES') {
+ console.error('error: %s(1) not executable. try chmod or run with root', bin);
}
process.exit(1);
});
@@ -578,15 +604,15 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
*/
Command.prototype.normalize = function(args) {
- var ret = []
- , arg
- , lastOpt
- , index;
+ var ret = [],
+ arg,
+ lastOpt,
+ index;
for (var i = 0, len = args.length; i < len; ++i) {
arg = args[i];
if (i > 0) {
- lastOpt = this.optionFor(args[i-1]);
+ lastOpt = this.optionFor(args[i - 1]);
}
if (arg === '--') {
@@ -595,7 +621,7 @@ Command.prototype.normalize = function(args) {
break;
} else if (lastOpt && lastOpt.required) {
ret.push(arg);
- } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
+ } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') {
arg.slice(1).split('').forEach(function(c) {
ret.push('-' + c);
});
@@ -626,10 +652,10 @@ Command.prototype.parseArgs = function(args, unknown) {
if (args.length) {
name = args[0];
- if (this.listeners(name).length) {
- this.emit(args.shift(), args, unknown);
+ if (this.listeners('command:' + name).length) {
+ this.emit('command:' + args.shift(), args, unknown);
} else {
- this.emit('*', args);
+ this.emit('command:*', args);
}
} else {
outputHelpIfNecessary(this, unknown);
@@ -639,6 +665,10 @@ Command.prototype.parseArgs = function(args, unknown) {
if (unknown.length > 0) {
this.unknownOption(unknown[0]);
}
+ if (this.commands.length === 0 &&
+ this._args.filter(function(a) { return a.required; }).length === 0) {
+ this.emit('command:*');
+ }
}
return this;
@@ -670,11 +700,11 @@ Command.prototype.optionFor = function(arg) {
*/
Command.prototype.parseOptions = function(argv) {
- var args = []
- , len = argv.length
- , literal
- , option
- , arg;
+ var args = [],
+ len = argv.length,
+ literal,
+ option,
+ arg;
var unknownOptions = [];
@@ -688,7 +718,7 @@ Command.prototype.parseOptions = function(argv) {
continue;
}
- if ('--' == arg) {
+ if (arg === '--') {
literal = true;
continue;
}
@@ -701,32 +731,32 @@ Command.prototype.parseOptions = function(argv) {
// requires arg
if (option.required) {
arg = argv[++i];
- if (null == arg) return this.optionMissingArgument(option);
- this.emit(option.name(), arg);
+ if (arg == null) return this.optionMissingArgument(option);
+ this.emit('option:' + option.name(), arg);
// optional arg
} else if (option.optional) {
- arg = argv[i+1];
- if (null == arg || ('-' == arg[0] && '-' != arg)) {
+ arg = argv[i + 1];
+ if (arg == null || (arg[0] === '-' && arg !== '-')) {
arg = null;
} else {
++i;
}
- this.emit(option.name(), arg);
+ this.emit('option:' + option.name(), arg);
// bool
} else {
- this.emit(option.name());
+ this.emit('option:' + option.name());
}
continue;
}
// looks like an option
- if (arg.length > 1 && '-' == arg[0]) {
+ if (arg.length > 1 && arg[0] === '-') {
unknownOptions.push(arg);
// If the next argument looks like it might be
// an argument for this option, we pass it on.
// If it isn't, then it'll simply be ignored
- if (argv[i+1] && '-' != argv[i+1][0]) {
+ if ((i + 1) < argv.length && argv[i + 1][0] !== '-') {
unknownOptions.push(argv[++i]);
}
continue;
@@ -746,12 +776,12 @@ Command.prototype.parseOptions = function(argv) {
* @api public
*/
Command.prototype.opts = function() {
- var result = {}
- , len = this.options.length;
+ var result = {},
+ len = this.options.length;
- for (var i = 0 ; i < len; i++) {
- var key = camelcase(this.options[i].name());
- result[key] = key === 'version' ? this._version : this[key];
+ for (var i = 0; i < len; i++) {
+ var key = this.options[i].attributeName();
+ result[key] = key === this._versionOptionName ? this._version : this[key];
}
return result;
};
@@ -764,9 +794,7 @@ Command.prototype.opts = function() {
*/
Command.prototype.missingArgument = function(name) {
- console.error();
- console.error(" error: missing required argument `%s'", name);
- console.error();
+ console.error("error: missing required argument `%s'", name);
process.exit(1);
};
@@ -779,13 +807,11 @@ Command.prototype.missingArgument = function(name) {
*/
Command.prototype.optionMissingArgument = function(option, flag) {
- console.error();
if (flag) {
- console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
+ console.error("error: option `%s' argument missing, got `%s'", option.flags, flag);
} else {
- console.error(" error: option `%s' argument missing", option.flags);
+ console.error("error: option `%s' argument missing", option.flags);
}
- console.error();
process.exit(1);
};
@@ -798,9 +824,7 @@ Command.prototype.optionMissingArgument = function(option, flag) {
Command.prototype.unknownOption = function(flag) {
if (this._allowUnknownOption) return;
- console.error();
- console.error(" error: unknown option `%s'", flag);
- console.error();
+ console.error("error: unknown option `%s'", flag);
process.exit(1);
};
@@ -812,9 +836,7 @@ Command.prototype.unknownOption = function(flag) {
*/
Command.prototype.variadicArgNotLast = function(name) {
- console.error();
- console.error(" error: variadic arguments must be last `%s'", name);
- console.error();
+ console.error("error: variadic arguments must be last `%s'", name);
process.exit(1);
};
@@ -825,17 +847,19 @@ Command.prototype.variadicArgNotLast = function(name) {
* which will print the version number when passed.
*
* @param {String} str
- * @param {String} flags
+ * @param {String} [flags]
* @return {Command} for chaining
* @api public
*/
Command.prototype.version = function(str, flags) {
- if (0 == arguments.length) return this._version;
+ if (arguments.length === 0) return this._version;
this._version = str;
flags = flags || '-V, --version';
- this.option(flags, 'output the version number');
- this.on('version', function() {
+ var versionOption = new Option(flags, 'output the version number');
+ this._versionOptionName = versionOption.long.substr(2) || 'version';
+ this.options.push(versionOption);
+ this.on('option:' + this._versionOptionName, function() {
process.stdout.write(str + '\n');
process.exit(0);
});
@@ -846,13 +870,15 @@ Command.prototype.version = function(str, flags) {
* Set the description to `str`.
*
* @param {String} str
+ * @param {Object} argsDescription
* @return {String|Command}
* @api public
*/
-Command.prototype.description = function(str) {
- if (0 === arguments.length) return this._description;
+Command.prototype.description = function(str, argsDescription) {
+ if (arguments.length === 0) return this._description;
this._description = str;
+ this._argsDescription = argsDescription;
return this;
};
@@ -866,12 +892,14 @@ Command.prototype.description = function(str) {
Command.prototype.alias = function(alias) {
var command = this;
- if(this.commands.length !== 0) {
- command = this.commands[this.commands.length - 1]
+ if (this.commands.length !== 0) {
+ command = this.commands[this.commands.length - 1];
}
if (arguments.length === 0) return command._alias;
+ if (alias === command._name) throw new Error('Command alias can\'t be the same as its name');
+
command._alias = alias;
return this;
};
@@ -889,26 +917,67 @@ Command.prototype.usage = function(str) {
return humanReadableArgName(arg);
});
- var usage = '[options]'
- + (this.commands.length ? ' [command]' : '')
- + (this._args.length ? ' ' + args.join(' ') : '');
+ var usage = '[options]' +
+ (this.commands.length ? ' [command]' : '') +
+ (this._args.length ? ' ' + args.join(' ') : '');
- if (0 == arguments.length) return this._usage || usage;
+ if (arguments.length === 0) return this._usage || usage;
this._usage = str;
return this;
};
/**
- * Get the name of the command
+ * Get or set the name of the command
*
- * @param {String} name
+ * @param {String} str
* @return {String|Command}
* @api public
*/
-Command.prototype.name = function() {
- return this._name;
+Command.prototype.name = function(str) {
+ if (arguments.length === 0) return this._name;
+ this._name = str;
+ return this;
+};
+
+/**
+ * Return prepared commands.
+ *
+ * @return {Array}
+ * @api private
+ */
+
+Command.prototype.prepareCommands = function() {
+ return this.commands.filter(function(cmd) {
+ return !cmd._noHelp;
+ }).map(function(cmd) {
+ var args = cmd._args.map(function(arg) {
+ return humanReadableArgName(arg);
+ }).join(' ');
+
+ return [
+ cmd._name +
+ (cmd._alias ? '|' + cmd._alias : '') +
+ (cmd.options.length ? ' [options]' : '') +
+ (args ? ' ' + args : ''),
+ cmd._description
+ ];
+ });
+};
+
+/**
+ * Return the largest command length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestCommandLength = function() {
+ var commands = this.prepareCommands();
+ return commands.reduce(function(max, command) {
+ return Math.max(max, command[0].length);
+ }, 0);
};
/**
@@ -919,11 +988,52 @@ Command.prototype.name = function() {
*/
Command.prototype.largestOptionLength = function() {
- return this.options.reduce(function(max, option) {
+ var options = [].slice.call(this.options);
+ options.push({
+ flags: '-h, --help'
+ });
+ return options.reduce(function(max, option) {
return Math.max(max, option.flags.length);
}, 0);
};
+/**
+ * Return the largest arg length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestArgLength = function() {
+ return this._args.reduce(function(max, arg) {
+ return Math.max(max, arg.name.length);
+ }, 0);
+};
+
+/**
+ * Return the pad width.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.padWidth = function() {
+ var width = this.largestOptionLength();
+ if (this._argsDescription && this._args.length) {
+ if (this.largestArgLength() > width) {
+ width = this.largestArgLength();
+ }
+ }
+
+ if (this.commands && this.commands.length) {
+ if (this.largestCommandLength() > width) {
+ width = this.largestCommandLength();
+ }
+ }
+
+ return width;
+};
+
/**
* Return help for options.
*
@@ -932,14 +1042,14 @@ Command.prototype.largestOptionLength = function() {
*/
Command.prototype.optionHelp = function() {
- var width = this.largestOptionLength();
+ var width = this.padWidth();
- // Prepend the help information
- return [pad('-h, --help', width) + ' ' + 'output usage information']
- .concat(this.options.map(function(option) {
- return pad(option.flags, width) + ' ' + option.description;
- }))
- .join('\n');
+ // Append the help information
+ return this.options.map(function(option) {
+ return pad(option.flags, width) + ' ' + option.description +
+ ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');
+ }).concat([pad('-h, --help', width) + ' ' + 'output usage information'])
+ .join('\n');
};
/**
@@ -952,35 +1062,16 @@ Command.prototype.optionHelp = function() {
Command.prototype.commandHelp = function() {
if (!this.commands.length) return '';
- var commands = this.commands.filter(function(cmd) {
- return !cmd._noHelp;
- }).map(function(cmd) {
- var args = cmd._args.map(function(arg) {
- return humanReadableArgName(arg);
- }).join(' ');
-
- return [
- cmd._name
- + (cmd._alias ? '|' + cmd._alias : '')
- + (cmd.options.length ? ' [options]' : '')
- + ' ' + args
- , cmd._description
- ];
- });
-
- var width = commands.reduce(function(max, command) {
- return Math.max(max, command[0].length);
- }, 0);
+ var commands = this.prepareCommands();
+ var width = this.padWidth();
return [
- ''
- , ' Commands:'
- , ''
- , commands.map(function(cmd) {
+ 'Commands:',
+ commands.map(function(cmd) {
var desc = cmd[1] ? ' ' + cmd[1] : '';
- return pad(cmd[0], width) + desc;
- }).join('\n').replace(/^/gm, ' ')
- , ''
+ return (desc ? pad(cmd[0], width) : cmd[0]) + desc;
+ }).join('\n').replace(/^/gm, ' '),
+ ''
].join('\n');
};
@@ -995,9 +1086,20 @@ Command.prototype.helpInformation = function() {
var desc = [];
if (this._description) {
desc = [
- ' ' + this._description
- , ''
+ this._description,
+ ''
];
+
+ var argsDescription = this._argsDescription;
+ if (argsDescription && this._args.length) {
+ var width = this.padWidth();
+ desc.push('Arguments:');
+ desc.push('');
+ this._args.forEach(function(arg) {
+ desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]);
+ });
+ desc.push('');
+ }
}
var cmdName = this._name;
@@ -1005,9 +1107,8 @@ Command.prototype.helpInformation = function() {
cmdName = cmdName + '|' + this._alias;
}
var usage = [
+ 'Usage: ' + cmdName + ' ' + this.usage(),
''
- ,' Usage: ' + cmdName + ' ' + this.usage()
- , ''
];
var cmds = [];
@@ -1015,17 +1116,15 @@ Command.prototype.helpInformation = function() {
if (commandHelp) cmds = [commandHelp];
var options = [
- ' Options:'
- , ''
- , '' + this.optionHelp().replace(/^/gm, ' ')
- , ''
- , ''
+ 'Options:',
+ '' + this.optionHelp().replace(/^/gm, ' '),
+ ''
];
return usage
- .concat(cmds)
.concat(desc)
.concat(options)
+ .concat(cmds)
.join('\n');
};
@@ -1039,7 +1138,7 @@ Command.prototype.outputHelp = function(cb) {
if (!cb) {
cb = function(passthru) {
return passthru;
- }
+ };
}
process.stdout.write(cb(this.helpInformation()));
this.emit('--help');
@@ -1095,7 +1194,7 @@ function pad(str, width) {
function outputHelpIfNecessary(cmd, options) {
options = options || [];
for (var i = 0; i < options.length; i++) {
- if (options[i] == '--help' || options[i] == '-h') {
+ if (options[i] === '--help' || options[i] === '-h') {
cmd.outputHelp();
process.exit(0);
}
@@ -1115,7 +1214,7 @@ function humanReadableArgName(arg) {
return arg.required
? '<' + nameOutput + '>'
- : '[' + nameOutput + ']'
+ : '[' + nameOutput + ']';
}
// for versions before node v0.8 when there weren't `fs.existsSync`
@@ -1128,4 +1227,3 @@ function exists(file) {
return false;
}
}
-
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 000000000..9f11925a2
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,2170 @@
+{
+ "name": "commander",
+ "version": "2.20.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
+ "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.0.0"
+ }
+ },
+ "@babel/highlight": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz",
+ "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.0.0",
+ "esutils": "^2.0.2",
+ "js-tokens": "^4.0.0"
+ },
+ "dependencies": {
+ "js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true
+ }
+ }
+ },
+ "@sinonjs/commons": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.0.2.tgz",
+ "integrity": "sha512-WR3dlgqJP4QNrLC4iXN/5/2WaLQQ0VijOOkmflqFGVJ6wLEpbSjo7c0ZeGIdtY8Crk7xBBp87sM6+Mkerz7alw==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "@sinonjs/formatio": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.0.0.tgz",
+ "integrity": "sha512-vdjoYLDptCgvtJs57ULshak3iJe4NW3sJ3g36xVDGff5AE8P30S6A093EIEPjdi2noGhfuNOEkbxt3J3awFW1w==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/samsam": "2.1.0"
+ },
+ "dependencies": {
+ "@sinonjs/samsam": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.0.tgz",
+ "integrity": "sha512-5x2kFgJYupaF1ns/RmharQ90lQkd2ELS8A9X0ymkAAdemYHGtI2KiUHG8nX2WU0T1qgnOU5YMqnBM2V7NUanNw==",
+ "dev": true,
+ "requires": {
+ "array-from": "^2.1.1"
+ }
+ }
+ }
+ },
+ "@sinonjs/samsam": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.1.tgz",
+ "integrity": "sha512-7oX6PXMulvdN37h88dvlvRyu61GYZau40fL4wEZvPEHvrjpJc3lDv6xDM5n4Z0StufUVB5nDvVZUM+jZHdMOOQ==",
+ "dev": true,
+ "requires": {
+ "array-from": "^2.1.1"
+ }
+ },
+ "@types/node": {
+ "version": "10.11.3",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.3.tgz",
+ "integrity": "sha512-3AvcEJAh9EMatxs+OxAlvAEs7OTy6AG94mcH1iqyVDwVVndekLxzwkWQ/Z4SDbY6GO2oyUXyWW8tQ4rENSSQVQ==",
+ "dev": true
+ },
+ "acorn": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz",
+ "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==",
+ "dev": true
+ },
+ "acorn-jsx": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-4.1.1.tgz",
+ "integrity": "sha512-JY+iV6r+cO21KtntVvFkD+iqjtdpRUpGqKWgfkCdZq1R+kbreEl8EcdcJR4SmiIgsIQT33s6QzheQ9a275Q8xw==",
+ "dev": true,
+ "requires": {
+ "acorn": "^5.0.3"
+ }
+ },
+ "ajv": {
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz",
+ "integrity": "sha512-LqZ9wY+fx3UMiiPd741yB2pj3hhil+hQc8taf4o2QGRFpWgZ2V5C8HA165DY9sS3fJwsk7uT7ZlFEyC3Ig3lLg==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^2.0.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ajv-keywords": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz",
+ "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=",
+ "dev": true
+ },
+ "ansi-escapes": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",
+ "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==",
+ "dev": true
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
+ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
+ "dev": true
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "array-from": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz",
+ "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=",
+ "dev": true
+ },
+ "array-includes": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz",
+ "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "es-abstract": "^1.7.0"
+ }
+ },
+ "array-union": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
+ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
+ "dev": true,
+ "requires": {
+ "array-uniq": "^1.0.1"
+ }
+ },
+ "array-uniq": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
+ "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=",
+ "dev": true
+ },
+ "arrify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
+ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",
+ "dev": true
+ },
+ "babel-code-frame": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
+ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
+ "dev": true,
+ "requires": {
+ "chalk": "^1.1.3",
+ "esutils": "^2.0.2",
+ "js-tokens": "^3.0.2"
+ },
+ "dependencies": {
+ "chalk": {
+ "version": "1.1.3",
+ "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^2.2.1",
+ "escape-string-regexp": "^1.0.2",
+ "has-ansi": "^2.0.0",
+ "strip-ansi": "^3.0.0",
+ "supports-color": "^2.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ }
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "dev": true
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "buffer-from": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz",
+ "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==",
+ "dev": true
+ },
+ "builtin-modules": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
+ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
+ "dev": true
+ },
+ "caller-path": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz",
+ "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=",
+ "dev": true,
+ "requires": {
+ "callsites": "^0.2.0"
+ }
+ },
+ "callsites": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz",
+ "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
+ "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "supports-color": {
+ "version": "5.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
+ "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "chardet": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz",
+ "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=",
+ "dev": true
+ },
+ "circular-json": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",
+ "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==",
+ "dev": true
+ },
+ "cli-cursor": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
+ "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
+ "dev": true,
+ "requires": {
+ "restore-cursor": "^2.0.0"
+ }
+ },
+ "cli-width": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
+ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",
+ "dev": true
+ },
+ "color-convert": {
+ "version": "1.9.2",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz",
+ "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.1"
+ }
+ },
+ "color-name": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz",
+ "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=",
+ "dev": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+ "dev": true
+ },
+ "contains-path": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz",
+ "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=",
+ "dev": true
+ },
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "debug": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "debug-log": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz",
+ "integrity": "sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8=",
+ "dev": true
+ },
+ "deep-is": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
+ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
+ "dev": true
+ },
+ "define-properties": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
+ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
+ "dev": true,
+ "requires": {
+ "object-keys": "^1.0.12"
+ }
+ },
+ "deglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/deglob/-/deglob-2.1.1.tgz",
+ "integrity": "sha512-2kjwuGGonL7gWE1XU4Fv79+vVzpoQCl0V+boMwWtOQJV2AGDabCwez++nB1Nli/8BabAfZQ/UuHPlp6AymKdWw==",
+ "dev": true,
+ "requires": {
+ "find-root": "^1.0.0",
+ "glob": "^7.0.5",
+ "ignore": "^3.0.9",
+ "pkg-config": "^1.1.0",
+ "run-parallel": "^1.1.2",
+ "uniq": "^1.0.1"
+ },
+ "dependencies": {
+ "ignore": {
+ "version": "3.3.10",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz",
+ "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",
+ "dev": true
+ }
+ }
+ },
+ "del": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz",
+ "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=",
+ "dev": true,
+ "requires": {
+ "globby": "^5.0.0",
+ "is-path-cwd": "^1.0.0",
+ "is-path-in-cwd": "^1.0.0",
+ "object-assign": "^4.0.1",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0",
+ "rimraf": "^2.2.8"
+ }
+ },
+ "diff": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
+ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
+ "dev": true
+ },
+ "doctrine": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
+ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
+ "dev": true,
+ "requires": {
+ "esutils": "^2.0.2"
+ }
+ },
+ "error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "es-abstract": {
+ "version": "1.12.0",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz",
+ "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==",
+ "dev": true,
+ "requires": {
+ "es-to-primitive": "^1.1.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.1",
+ "is-callable": "^1.1.3",
+ "is-regex": "^1.0.4"
+ }
+ },
+ "es-to-primitive": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz",
+ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=",
+ "dev": true,
+ "requires": {
+ "is-callable": "^1.1.1",
+ "is-date-object": "^1.0.1",
+ "is-symbol": "^1.0.1"
+ }
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true
+ },
+ "eslint": {
+ "version": "5.6.1",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.6.1.tgz",
+ "integrity": "sha512-hgrDtGWz368b7Wqf+v1Z69O3ZebNR0+GA7PtDdbmuz4rInFVUV9uw7whjZEiWyLzCjVb5Rs5WRN1TAS6eo7AYA==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "ajv": "^6.5.3",
+ "chalk": "^2.1.0",
+ "cross-spawn": "^6.0.5",
+ "debug": "^4.0.1",
+ "doctrine": "^2.1.0",
+ "eslint-scope": "^4.0.0",
+ "eslint-utils": "^1.3.1",
+ "eslint-visitor-keys": "^1.0.0",
+ "espree": "^4.0.0",
+ "esquery": "^1.0.1",
+ "esutils": "^2.0.2",
+ "file-entry-cache": "^2.0.0",
+ "functional-red-black-tree": "^1.0.1",
+ "glob": "^7.1.2",
+ "globals": "^11.7.0",
+ "ignore": "^4.0.6",
+ "imurmurhash": "^0.1.4",
+ "inquirer": "^6.1.0",
+ "is-resolvable": "^1.1.0",
+ "js-yaml": "^3.12.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "levn": "^0.3.0",
+ "lodash": "^4.17.5",
+ "minimatch": "^3.0.4",
+ "mkdirp": "^0.5.1",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.8.2",
+ "path-is-inside": "^1.0.2",
+ "pluralize": "^7.0.0",
+ "progress": "^2.0.0",
+ "regexpp": "^2.0.0",
+ "require-uncached": "^1.0.3",
+ "semver": "^5.5.1",
+ "strip-ansi": "^4.0.0",
+ "strip-json-comments": "^2.0.1",
+ "table": "^4.0.3",
+ "text-table": "^0.2.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.0.1.tgz",
+ "integrity": "sha512-K23FHJ/Mt404FSlp6gSZCevIbTMLX0j3fmHhUEhQ3Wq0FMODW3+cUSoLdy1Gx4polAf4t/lphhmHH35BB8cLYw==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
+ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
+ "dev": true
+ },
+ "semver": {
+ "version": "5.5.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz",
+ "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==",
+ "dev": true
+ }
+ }
+ },
+ "eslint-config-standard": {
+ "version": "12.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz",
+ "integrity": "sha512-COUz8FnXhqFitYj4DTqHzidjIL/t4mumGZto5c7DrBpvWoie+Sn3P4sLEzUGeYhRElWuFEf8K1S1EfvD1vixCQ==",
+ "dev": true
+ },
+ "eslint-config-standard-jsx": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-6.0.2.tgz",
+ "integrity": "sha512-D+YWAoXw+2GIdbMBRAzWwr1ZtvnSf4n4yL0gKGg7ShUOGXkSOLerI17K4F6LdQMJPNMoWYqepzQD/fKY+tXNSg==",
+ "dev": true
+ },
+ "eslint-import-resolver-node": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz",
+ "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==",
+ "dev": true,
+ "requires": {
+ "debug": "^2.6.9",
+ "resolve": "^1.5.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ }
+ }
+ },
+ "eslint-module-utils": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz",
+ "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=",
+ "dev": true,
+ "requires": {
+ "debug": "^2.6.8",
+ "pkg-dir": "^1.0.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ }
+ }
+ },
+ "eslint-plugin-es": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-1.3.1.tgz",
+ "integrity": "sha512-9XcVyZiQRVeFjqHw8qHNDAZcQLqaHlOGGpeYqzYh8S4JYCWTCO3yzyen8yVmA5PratfzTRWDwCOFphtDEG+w/w==",
+ "dev": true,
+ "requires": {
+ "eslint-utils": "^1.3.0",
+ "regexpp": "^2.0.0"
+ }
+ },
+ "eslint-plugin-import": {
+ "version": "2.14.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz",
+ "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==",
+ "dev": true,
+ "requires": {
+ "contains-path": "^0.1.0",
+ "debug": "^2.6.8",
+ "doctrine": "1.5.0",
+ "eslint-import-resolver-node": "^0.3.1",
+ "eslint-module-utils": "^2.2.0",
+ "has": "^1.0.1",
+ "lodash": "^4.17.4",
+ "minimatch": "^3.0.3",
+ "read-pkg-up": "^2.0.0",
+ "resolve": "^1.6.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "doctrine": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz",
+ "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=",
+ "dev": true,
+ "requires": {
+ "esutils": "^2.0.2",
+ "isarray": "^1.0.0"
+ }
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
+ "dev": true
+ }
+ }
+ },
+ "eslint-plugin-node": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-7.0.1.tgz",
+ "integrity": "sha512-lfVw3TEqThwq0j2Ba/Ckn2ABdwmL5dkOgAux1rvOk6CO7A6yGyPI2+zIxN6FyNkp1X1X/BSvKOceD6mBWSj4Yw==",
+ "dev": true,
+ "requires": {
+ "eslint-plugin-es": "^1.3.1",
+ "eslint-utils": "^1.3.1",
+ "ignore": "^4.0.2",
+ "minimatch": "^3.0.4",
+ "resolve": "^1.8.1",
+ "semver": "^5.5.0"
+ }
+ },
+ "eslint-plugin-promise": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.0.1.tgz",
+ "integrity": "sha512-Si16O0+Hqz1gDHsys6RtFRrW7cCTB6P7p3OJmKp3Y3dxpQE2qwOA7d3xnV+0mBmrPoi0RBnxlCKvqu70te6wjg==",
+ "dev": true
+ },
+ "eslint-plugin-react": {
+ "version": "7.11.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz",
+ "integrity": "sha512-cVVyMadRyW7qsIUh3FHp3u6QHNhOgVrLQYdQEB1bPWBsgbNCHdFAeNMquBMCcZJu59eNthX053L70l7gRt4SCw==",
+ "dev": true,
+ "requires": {
+ "array-includes": "^3.0.3",
+ "doctrine": "^2.1.0",
+ "has": "^1.0.3",
+ "jsx-ast-utils": "^2.0.1",
+ "prop-types": "^15.6.2"
+ }
+ },
+ "eslint-plugin-standard": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.0.tgz",
+ "integrity": "sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA==",
+ "dev": true
+ },
+ "eslint-scope": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz",
+ "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==",
+ "dev": true,
+ "requires": {
+ "esrecurse": "^4.1.0",
+ "estraverse": "^4.1.1"
+ }
+ },
+ "eslint-utils": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz",
+ "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==",
+ "dev": true
+ },
+ "eslint-visitor-keys": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
+ "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==",
+ "dev": true
+ },
+ "espree": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-4.0.0.tgz",
+ "integrity": "sha512-kapdTCt1bjmspxStVKX6huolXVV5ZfyZguY1lcfhVVZstce3bqxH9mcLzNn3/mlgW6wQ732+0fuG9v7h0ZQoKg==",
+ "dev": true,
+ "requires": {
+ "acorn": "^5.6.0",
+ "acorn-jsx": "^4.1.1"
+ }
+ },
+ "esprima": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
+ "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
+ "dev": true
+ },
+ "esquery": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz",
+ "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^4.0.0"
+ }
+ },
+ "esrecurse": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz",
+ "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^4.1.0"
+ }
+ },
+ "estraverse": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",
+ "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=",
+ "dev": true
+ },
+ "esutils": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
+ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
+ "dev": true
+ },
+ "external-editor": {
+ "version": "2.2.0",
+ "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
+ "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==",
+ "dev": true,
+ "requires": {
+ "chardet": "^0.4.0",
+ "iconv-lite": "^0.4.17",
+ "tmp": "^0.0.33"
+ }
+ },
+ "fast-deep-equal": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
+ "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
+ "dev": true
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
+ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
+ "dev": true
+ },
+ "fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
+ "dev": true
+ },
+ "figures": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
+ "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
+ "dev": true,
+ "requires": {
+ "escape-string-regexp": "^1.0.5"
+ }
+ },
+ "file-entry-cache": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",
+ "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=",
+ "dev": true,
+ "requires": {
+ "flat-cache": "^1.2.1",
+ "object-assign": "^4.0.1"
+ }
+ },
+ "find-root": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
+ "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==",
+ "dev": true
+ },
+ "find-up": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
+ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
+ "dev": true,
+ "requires": {
+ "path-exists": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "flat-cache": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz",
+ "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=",
+ "dev": true,
+ "requires": {
+ "circular-json": "^0.3.1",
+ "del": "^2.0.2",
+ "graceful-fs": "^4.1.2",
+ "write": "^0.2.1"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+ "dev": true
+ },
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
+ "functional-red-black-tree": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
+ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
+ "dev": true
+ },
+ "get-stdin": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz",
+ "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==",
+ "dev": true
+ },
+ "glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "globals": {
+ "version": "11.7.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz",
+ "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==",
+ "dev": true
+ },
+ "globby": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz",
+ "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=",
+ "dev": true,
+ "requires": {
+ "array-union": "^1.0.1",
+ "arrify": "^1.0.0",
+ "glob": "^7.0.3",
+ "object-assign": "^4.0.1",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.1.11",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
+ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
+ "dev": true
+ },
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
+ "has-ansi": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
+ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "dev": true
+ },
+ "hosted-git-info": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz",
+ "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",
+ "dev": true
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "dev": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "ignore": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
+ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
+ "dev": true
+ },
+ "imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
+ "dev": true
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "dev": true,
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "dev": true
+ },
+ "inquirer": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz",
+ "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==",
+ "dev": true,
+ "requires": {
+ "ansi-escapes": "^3.0.0",
+ "chalk": "^2.0.0",
+ "cli-cursor": "^2.1.0",
+ "cli-width": "^2.0.0",
+ "external-editor": "^3.0.0",
+ "figures": "^2.0.0",
+ "lodash": "^4.17.10",
+ "mute-stream": "0.0.7",
+ "run-async": "^2.2.0",
+ "rxjs": "^6.1.0",
+ "string-width": "^2.1.0",
+ "strip-ansi": "^4.0.0",
+ "through": "^2.3.6"
+ },
+ "dependencies": {
+ "chardet": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
+ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
+ "dev": true
+ },
+ "external-editor": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz",
+ "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==",
+ "dev": true,
+ "requires": {
+ "chardet": "^0.7.0",
+ "iconv-lite": "^0.4.24",
+ "tmp": "^0.0.33"
+ }
+ }
+ }
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
+ "dev": true
+ },
+ "is-builtin-module": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
+ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
+ "dev": true,
+ "requires": {
+ "builtin-modules": "^1.0.0"
+ }
+ },
+ "is-callable": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
+ "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",
+ "dev": true
+ },
+ "is-date-object": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
+ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "is-path-cwd": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",
+ "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=",
+ "dev": true
+ },
+ "is-path-in-cwd": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz",
+ "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==",
+ "dev": true,
+ "requires": {
+ "is-path-inside": "^1.0.0"
+ }
+ },
+ "is-path-inside": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz",
+ "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=",
+ "dev": true,
+ "requires": {
+ "path-is-inside": "^1.0.1"
+ }
+ },
+ "is-promise": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
+ "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",
+ "dev": true
+ },
+ "is-regex": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
+ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.1"
+ }
+ },
+ "is-resolvable": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz",
+ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==",
+ "dev": true
+ },
+ "is-symbol": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz",
+ "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=",
+ "dev": true
+ },
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
+ },
+ "js-tokens": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
+ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
+ "dev": true
+ },
+ "js-yaml": {
+ "version": "3.12.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",
+ "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",
+ "dev": true,
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "json-parse-better-errors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
+ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
+ "dev": true
+ },
+ "json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true
+ },
+ "json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
+ "dev": true
+ },
+ "jsx-ast-utils": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz",
+ "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=",
+ "dev": true,
+ "requires": {
+ "array-includes": "^3.0.3"
+ }
+ },
+ "just-extend": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-3.0.0.tgz",
+ "integrity": "sha512-Fu3T6pKBuxjWT/p4DkqGHFRsysc8OauWr4ZRTY9dIx07Y9O0RkoR5jcv28aeD1vuAwhm3nLkDurwLXoALp4DpQ==",
+ "dev": true
+ },
+ "levn": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2"
+ }
+ },
+ "load-json-file": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
+ "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^2.2.0",
+ "pify": "^2.0.0",
+ "strip-bom": "^3.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
+ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
+ "dev": true,
+ "requires": {
+ "p-locate": "^2.0.0",
+ "path-exists": "^3.0.0"
+ },
+ "dependencies": {
+ "path-exists": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
+ "dev": true
+ }
+ }
+ },
+ "lodash": {
+ "version": "4.17.10",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
+ "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==",
+ "dev": true
+ },
+ "lodash.get": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
+ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=",
+ "dev": true
+ },
+ "lolex": {
+ "version": "2.7.5",
+ "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz",
+ "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==",
+ "dev": true
+ },
+ "loose-envify": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "dev": true,
+ "requires": {
+ "js-tokens": "^3.0.0 || ^4.0.0"
+ }
+ },
+ "make-error": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz",
+ "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==",
+ "dev": true
+ },
+ "mimic-fn": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
+ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
+ "dev": true
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
+ "dev": true
+ },
+ "mkdirp": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
+ "dev": true,
+ "requires": {
+ "minimist": "0.0.8"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "mute-stream": {
+ "version": "0.0.7",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
+ "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
+ "dev": true
+ },
+ "natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
+ "dev": true
+ },
+ "nice-try": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
+ "dev": true
+ },
+ "nise": {
+ "version": "1.4.5",
+ "resolved": "https://registry.npmjs.org/nise/-/nise-1.4.5.tgz",
+ "integrity": "sha512-OHRVvdxKgwZELf2DTgsJEIA4MOq8XWvpSUzoOXyxJ2mY0mMENWC66+70AShLR2z05B1dzrzWlUQJmJERlOUpZw==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/formatio": "3.0.0",
+ "just-extend": "^3.0.0",
+ "lolex": "^2.3.2",
+ "path-to-regexp": "^1.7.0",
+ "text-encoding": "^0.6.4"
+ }
+ },
+ "normalize-package-data": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
+ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
+ "dev": true,
+ "requires": {
+ "hosted-git-info": "^2.1.4",
+ "is-builtin-module": "^1.0.0",
+ "semver": "2 || 3 || 4 || 5",
+ "validate-npm-package-license": "^3.0.1"
+ }
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
+ "dev": true
+ },
+ "object-keys": {
+ "version": "1.0.12",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz",
+ "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==",
+ "dev": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "onetime": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
+ "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
+ "dev": true,
+ "requires": {
+ "mimic-fn": "^1.0.0"
+ }
+ },
+ "optionator": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
+ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=",
+ "dev": true,
+ "requires": {
+ "deep-is": "~0.1.3",
+ "fast-levenshtein": "~2.0.4",
+ "levn": "~0.3.0",
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2",
+ "wordwrap": "~1.0.0"
+ }
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
+ "dev": true
+ },
+ "p-limit": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
+ "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
+ "dev": true,
+ "requires": {
+ "p-try": "^1.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
+ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
+ "dev": true,
+ "requires": {
+ "p-limit": "^1.1.0"
+ }
+ },
+ "p-try": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
+ "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",
+ "dev": true
+ },
+ "parse-json": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
+ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.2.0"
+ }
+ },
+ "path-exists": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
+ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
+ "dev": true,
+ "requires": {
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "dev": true
+ },
+ "path-is-inside": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
+ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",
+ "dev": true
+ },
+ "path-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
+ "dev": true
+ },
+ "path-parse": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
+ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+ "dev": true
+ },
+ "path-to-regexp": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz",
+ "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=",
+ "dev": true,
+ "requires": {
+ "isarray": "0.0.1"
+ }
+ },
+ "path-type": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
+ "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
+ "dev": true,
+ "requires": {
+ "pify": "^2.0.0"
+ }
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ },
+ "pinkie": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
+ "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
+ "dev": true
+ },
+ "pinkie-promise": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
+ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
+ "dev": true,
+ "requires": {
+ "pinkie": "^2.0.0"
+ }
+ },
+ "pkg-conf": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz",
+ "integrity": "sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=",
+ "dev": true,
+ "requires": {
+ "find-up": "^2.0.0",
+ "load-json-file": "^4.0.0"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
+ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
+ "dev": true,
+ "requires": {
+ "locate-path": "^2.0.0"
+ }
+ },
+ "load-json-file": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
+ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^4.0.0",
+ "pify": "^3.0.0",
+ "strip-bom": "^3.0.0"
+ }
+ },
+ "parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.3.1",
+ "json-parse-better-errors": "^1.0.1"
+ }
+ },
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true
+ }
+ }
+ },
+ "pkg-config": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/pkg-config/-/pkg-config-1.1.1.tgz",
+ "integrity": "sha1-VX7yLXPaPIg3EHdmxS6tq94pj+Q=",
+ "dev": true,
+ "requires": {
+ "debug-log": "^1.0.0",
+ "find-root": "^1.0.0",
+ "xtend": "^4.0.1"
+ }
+ },
+ "pkg-dir": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz",
+ "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=",
+ "dev": true,
+ "requires": {
+ "find-up": "^1.0.0"
+ }
+ },
+ "pluralize": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz",
+ "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==",
+ "dev": true
+ },
+ "prelude-ls": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
+ "dev": true
+ },
+ "progress": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz",
+ "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=",
+ "dev": true
+ },
+ "prop-types": {
+ "version": "15.6.2",
+ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz",
+ "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==",
+ "dev": true,
+ "requires": {
+ "loose-envify": "^1.3.1",
+ "object-assign": "^4.1.1"
+ }
+ },
+ "punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+ "dev": true
+ },
+ "read-pkg": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
+ "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "^2.0.0",
+ "normalize-package-data": "^2.3.2",
+ "path-type": "^2.0.0"
+ }
+ },
+ "read-pkg-up": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
+ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
+ "dev": true,
+ "requires": {
+ "find-up": "^2.0.0",
+ "read-pkg": "^2.0.0"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
+ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
+ "dev": true,
+ "requires": {
+ "locate-path": "^2.0.0"
+ }
+ }
+ }
+ },
+ "regexpp": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.0.tgz",
+ "integrity": "sha512-g2FAVtR8Uh8GO1Nv5wpxW7VFVwHcCEr4wyA8/MHiRkO8uHoR5ntAA8Uq3P1vvMTX/BeQiRVSpDGLd+Wn5HNOTA==",
+ "dev": true
+ },
+ "require-uncached": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",
+ "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=",
+ "dev": true,
+ "requires": {
+ "caller-path": "^0.1.0",
+ "resolve-from": "^1.0.0"
+ }
+ },
+ "resolve": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz",
+ "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==",
+ "dev": true,
+ "requires": {
+ "path-parse": "^1.0.5"
+ }
+ },
+ "resolve-from": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz",
+ "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=",
+ "dev": true
+ },
+ "restore-cursor": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
+ "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
+ "dev": true,
+ "requires": {
+ "onetime": "^2.0.0",
+ "signal-exit": "^3.0.2"
+ }
+ },
+ "rimraf": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
+ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.0.5"
+ }
+ },
+ "run-async": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
+ "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=",
+ "dev": true,
+ "requires": {
+ "is-promise": "^2.1.0"
+ }
+ },
+ "run-parallel": {
+ "version": "1.1.9",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz",
+ "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==",
+ "dev": true
+ },
+ "rxjs": {
+ "version": "6.3.3",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz",
+ "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
+ "semver": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
+ "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
+ "dev": true
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
+ "dev": true
+ },
+ "should": {
+ "version": "13.2.3",
+ "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz",
+ "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==",
+ "dev": true,
+ "requires": {
+ "should-equal": "^2.0.0",
+ "should-format": "^3.0.3",
+ "should-type": "^1.4.0",
+ "should-type-adaptors": "^1.0.1",
+ "should-util": "^1.0.0"
+ }
+ },
+ "should-equal": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz",
+ "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==",
+ "dev": true,
+ "requires": {
+ "should-type": "^1.4.0"
+ }
+ },
+ "should-format": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz",
+ "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=",
+ "dev": true,
+ "requires": {
+ "should-type": "^1.3.0",
+ "should-type-adaptors": "^1.0.1"
+ }
+ },
+ "should-type": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz",
+ "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=",
+ "dev": true
+ },
+ "should-type-adaptors": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz",
+ "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==",
+ "dev": true,
+ "requires": {
+ "should-type": "^1.3.0",
+ "should-util": "^1.0.0"
+ }
+ },
+ "should-util": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz",
+ "integrity": "sha1-yYzaN0qmsZDfi6h8mInCtNtiAGM=",
+ "dev": true
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
+ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
+ "dev": true
+ },
+ "sinon": {
+ "version": "6.3.4",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-6.3.4.tgz",
+ "integrity": "sha512-NIaR56Z1mefuRBXYrf4otqBxkWiKveX+fvqs3HzFq2b07HcgpkMgIwmQM/owNjNFAHkx0kJXW+Q0mDthiuslXw==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.0.2",
+ "@sinonjs/formatio": "^3.0.0",
+ "@sinonjs/samsam": "^2.1.1",
+ "diff": "^3.5.0",
+ "lodash.get": "^4.4.2",
+ "lolex": "^2.7.4",
+ "nise": "^1.4.5",
+ "supports-color": "^5.5.0",
+ "type-detect": "^4.0.8"
+ },
+ "dependencies": {
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "slice-ansi": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz",
+ "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==",
+ "dev": true,
+ "requires": {
+ "is-fullwidth-code-point": "^2.0.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "source-map-support": {
+ "version": "0.5.8",
+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.8.tgz",
+ "integrity": "sha512-WqAEWPdb78u25RfKzOF0swBpY0dKrNdjc4GvLwm7ScX/o9bj8Eh/YL8mcMhBHYDGl87UkkSXDOFnW4G7GhWhGg==",
+ "dev": true,
+ "requires": {
+ "buffer-from": "^1.0.0",
+ "source-map": "^0.6.0"
+ }
+ },
+ "spdx-correct": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz",
+ "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==",
+ "dev": true,
+ "requires": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-exceptions": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz",
+ "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==",
+ "dev": true
+ },
+ "spdx-expression-parse": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
+ "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
+ "dev": true,
+ "requires": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-license-ids": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz",
+ "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==",
+ "dev": true
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true
+ },
+ "standard": {
+ "version": "12.0.1",
+ "resolved": "https://registry.npmjs.org/standard/-/standard-12.0.1.tgz",
+ "integrity": "sha512-UqdHjh87OG2gUrNCSM4QRLF5n9h3TFPwrCNyVlkqu31Hej0L/rc8hzKqVvkb2W3x0WMq7PzZdkLfEcBhVOR6lg==",
+ "dev": true,
+ "requires": {
+ "eslint": "~5.4.0",
+ "eslint-config-standard": "12.0.0",
+ "eslint-config-standard-jsx": "6.0.2",
+ "eslint-plugin-import": "~2.14.0",
+ "eslint-plugin-node": "~7.0.1",
+ "eslint-plugin-promise": "~4.0.0",
+ "eslint-plugin-react": "~7.11.1",
+ "eslint-plugin-standard": "~4.0.0",
+ "standard-engine": "~9.0.0"
+ },
+ "dependencies": {
+ "eslint": {
+ "version": "5.4.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz",
+ "integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.5.0",
+ "babel-code-frame": "^6.26.0",
+ "chalk": "^2.1.0",
+ "cross-spawn": "^6.0.5",
+ "debug": "^3.1.0",
+ "doctrine": "^2.1.0",
+ "eslint-scope": "^4.0.0",
+ "eslint-utils": "^1.3.1",
+ "eslint-visitor-keys": "^1.0.0",
+ "espree": "^4.0.0",
+ "esquery": "^1.0.1",
+ "esutils": "^2.0.2",
+ "file-entry-cache": "^2.0.0",
+ "functional-red-black-tree": "^1.0.1",
+ "glob": "^7.1.2",
+ "globals": "^11.7.0",
+ "ignore": "^4.0.2",
+ "imurmurhash": "^0.1.4",
+ "inquirer": "^5.2.0",
+ "is-resolvable": "^1.1.0",
+ "js-yaml": "^3.11.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "levn": "^0.3.0",
+ "lodash": "^4.17.5",
+ "minimatch": "^3.0.4",
+ "mkdirp": "^0.5.1",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.8.2",
+ "path-is-inside": "^1.0.2",
+ "pluralize": "^7.0.0",
+ "progress": "^2.0.0",
+ "regexpp": "^2.0.0",
+ "require-uncached": "^1.0.3",
+ "semver": "^5.5.0",
+ "strip-ansi": "^4.0.0",
+ "strip-json-comments": "^2.0.1",
+ "table": "^4.0.3",
+ "text-table": "^0.2.0"
+ }
+ },
+ "inquirer": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz",
+ "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==",
+ "dev": true,
+ "requires": {
+ "ansi-escapes": "^3.0.0",
+ "chalk": "^2.0.0",
+ "cli-cursor": "^2.1.0",
+ "cli-width": "^2.0.0",
+ "external-editor": "^2.1.0",
+ "figures": "^2.0.0",
+ "lodash": "^4.3.0",
+ "mute-stream": "0.0.7",
+ "run-async": "^2.2.0",
+ "rxjs": "^5.5.2",
+ "string-width": "^2.1.0",
+ "strip-ansi": "^4.0.0",
+ "through": "^2.3.6"
+ }
+ },
+ "rxjs": {
+ "version": "5.5.12",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.12.tgz",
+ "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==",
+ "dev": true,
+ "requires": {
+ "symbol-observable": "1.0.1"
+ }
+ }
+ }
+ },
+ "standard-engine": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-9.0.0.tgz",
+ "integrity": "sha512-ZfNfCWZ2Xq67VNvKMPiVMKHnMdvxYzvZkf1AH8/cw2NLDBm5LRsxMqvEJpsjLI/dUosZ3Z1d6JlHDp5rAvvk2w==",
+ "dev": true,
+ "requires": {
+ "deglob": "^2.1.0",
+ "get-stdin": "^6.0.0",
+ "minimist": "^1.1.0",
+ "pkg-conf": "^2.0.0"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ }
+ }
+ },
+ "string-width": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
+ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
+ "dev": true,
+ "requires": {
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^4.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
+ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
+ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+ "dev": true
+ }
+ }
+ },
+ "strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
+ "dev": true
+ },
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
+ "dev": true
+ },
+ "symbol-observable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz",
+ "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=",
+ "dev": true
+ },
+ "table": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/table/-/table-4.0.3.tgz",
+ "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.0.1",
+ "ajv-keywords": "^3.0.0",
+ "chalk": "^2.1.0",
+ "lodash": "^4.17.4",
+ "slice-ansi": "1.0.0",
+ "string-width": "^2.1.1"
+ }
+ },
+ "text-encoding": {
+ "version": "0.6.4",
+ "resolved": "http://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz",
+ "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=",
+ "dev": true
+ },
+ "text-table": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
+ "dev": true
+ },
+ "through": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
+ "dev": true
+ },
+ "tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "dev": true,
+ "requires": {
+ "os-tmpdir": "~1.0.2"
+ }
+ },
+ "ts-node": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz",
+ "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==",
+ "dev": true,
+ "requires": {
+ "arrify": "^1.0.0",
+ "buffer-from": "^1.1.0",
+ "diff": "^3.1.0",
+ "make-error": "^1.1.1",
+ "minimist": "^1.2.0",
+ "mkdirp": "^0.5.1",
+ "source-map-support": "^0.5.6",
+ "yn": "^2.0.0"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ }
+ }
+ },
+ "tslib": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
+ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==",
+ "dev": true
+ },
+ "type-check": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2"
+ }
+ },
+ "type-detect": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
+ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
+ "dev": true
+ },
+ "typescript": {
+ "version": "2.9.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
+ "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
+ "dev": true
+ },
+ "uniq": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz",
+ "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=",
+ "dev": true
+ },
+ "uri-js": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
+ "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
+ "dev": true,
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "dev": true,
+ "requires": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "wordwrap": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
+ "dev": true
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ },
+ "write": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz",
+ "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=",
+ "dev": true,
+ "requires": {
+ "mkdirp": "^0.5.1"
+ }
+ },
+ "xtend": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
+ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
+ "dev": true
+ },
+ "yn": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
+ "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=",
+ "dev": true
+ }
+ }
+}
diff --git a/package.json b/package.json
index fb7a2bba0..098df2bbc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "commander",
- "version": "2.9.0",
+ "version": "2.20.0",
"description": "the complete solution for node.js command-line programs",
"keywords": [
"commander",
@@ -14,21 +14,25 @@
"type": "git",
"url": "https://github.com/tj/commander.js.git"
},
- "devDependencies": {
- "should": ">= 0.0.1 <9.0.0",
- "sinon": ">=1.17.1"
- },
"scripts": {
- "test": "make test"
+ "lint": "eslint index.js",
+ "test": "node test/run.js && npm run test-typings",
+ "test-typings": "tsc -p tsconfig.json"
},
"main": "index",
- "engines": {
- "node": ">= 0.6.x"
- },
"files": [
- "index.js"
+ "index.js",
+ "typings/index.d.ts"
],
- "dependencies": {
- "graceful-readlink": ">= 1.0.0"
- }
+ "dependencies": {},
+ "devDependencies": {
+ "@types/node": "^10.11.3",
+ "eslint": "^5.6.1",
+ "should": "^13.2.3",
+ "sinon": "^6.3.4",
+ "standard": "^12.0.1",
+ "ts-node": "^7.0.1",
+ "typescript": "^2.9.2"
+ },
+ "typings": "typings/index.d.ts"
}
diff --git a/test/fixtures-ts/pm-install.ts b/test/fixtures-ts/pm-install.ts
new file mode 100644
index 000000000..a99408b45
--- /dev/null
+++ b/test/fixtures-ts/pm-install.ts
@@ -0,0 +1,3 @@
+#!/usr/bin/env node
+
+console.log('install');
diff --git a/test/fixtures-ts/pm.ts b/test/fixtures-ts/pm.ts
new file mode 100644
index 000000000..723ccb772
--- /dev/null
+++ b/test/fixtures-ts/pm.ts
@@ -0,0 +1,8 @@
+#!/usr/bin/env node
+
+var program = require('../../');
+
+program
+ .version('0.0.1')
+ .command('install [name]', 'install one or more packages')
+ .parse(process.argv);
diff --git a/test/fixtures/another-dir/pm b/test/fixtures/another-dir/pm
new file mode 120000
index 000000000..9e8f71e18
--- /dev/null
+++ b/test/fixtures/another-dir/pm
@@ -0,0 +1 @@
+../other-dir/pm
\ No newline at end of file
diff --git a/test/fixtures/other-dir/pm b/test/fixtures/other-dir/pm
new file mode 120000
index 000000000..d7569ef30
--- /dev/null
+++ b/test/fixtures/other-dir/pm
@@ -0,0 +1 @@
+../pm
\ No newline at end of file
diff --git a/test/fixtures/pm b/test/fixtures/pm
index 4452010cd..d86822d9b 100755
--- a/test/fixtures/pm
+++ b/test/fixtures/pm
@@ -8,6 +8,7 @@ program
.command('search [query]', 'search with optional query').alias('s')
.command('cache', 'actions dealing with the cache').alias('c')
.command('list', 'list packages installed')
+ .command('listen', 'listen for supported signal events').alias('l')
.command('publish', 'publish or update package').alias('p')
.command('default', 'default command', {noHelp: true, isDefault: true})
.parse(process.argv);
diff --git a/test/fixtures/pm-listen b/test/fixtures/pm-listen
new file mode 100755
index 000000000..f75e89007
--- /dev/null
+++ b/test/fixtures/pm-listen
@@ -0,0 +1,28 @@
+#!/usr/bin/env node
+
+process.on('SIGUSR1', function(){
+ console.log('SIGUSR1');
+ process.exit();
+});
+
+process.on('SIGUSR2', function(){
+ console.log('SIGUSR2');
+ process.exit();
+});
+
+process.on('SIGTERM', function(){
+ console.log('SIGTERM');
+ process.exit();
+});
+
+process.on('SIGINT', function(){
+ console.log('SIGINT');
+ process.exit();
+});
+
+process.on('SIGHUP', function(){
+ console.log('SIGHUP');
+ process.exit();
+});
+
+setInterval(function(){}, 5000); // Mimic a running process
\ No newline at end of file
diff --git a/test/run b/test/run
deleted file mode 100755
index 37893b525..000000000
--- a/test/run
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-export NODE_ENV=test
-
-echo
-for file in $@; do
- printf "\033[90m ${file#test/}\033[0m "
- node $file 2> /tmp/stderr && echo "\033[36m✓\033[0m"
- code=$?
- if test $code -ne 0; then
- echo "\033[31m✖\033[0m"
- cat /tmp/stderr >&2
- exit $code
- fi
-done
-echo
\ No newline at end of file
diff --git a/test/run.js b/test/run.js
new file mode 100644
index 000000000..45ddce056
--- /dev/null
+++ b/test/run.js
@@ -0,0 +1,22 @@
+#!/usr/bin/env node
+
+const { spawnSync } = require('child_process')
+const { readdirSync } = require('fs')
+const { extname, join } = require('path')
+
+process.env.NODE_ENV = 'test';
+
+process.stdout.write('\n')
+readdirSync(__dirname).forEach((file) => {
+ if (!file.startsWith('test.') || extname(file) !== '.js')
+ return;
+ process.stdout.write(`\x1b[90m ${file}\x1b[0m `);
+ const result = spawnSync(process.argv0, [ join('test', file) ]);
+ if (result.status === 0) {
+ process.stdout.write('\x1b[36m✓\x1b[0m\n');
+ } else {
+ process.stdout.write('\x1b[31m✖\x1b[0m\n');
+ console.error(result.stderr.toString('utf8'));
+ process.exit(result.status);
+ }
+})
diff --git a/test/test.command.action.emptyOption.js b/test/test.command.action.emptyOption.js
new file mode 100644
index 000000000..33276754f
--- /dev/null
+++ b/test/test.command.action.emptyOption.js
@@ -0,0 +1,20 @@
+/**
+ * Module dependencies.
+ */
+
+var program = require('../')
+ , should = require('should');
+
+var val = "some cheese"
+program
+ .name('test')
+ .command('mycommand')
+ .option('-c, --cheese [type]', 'optionally specify the type of cheese')
+ .action(function(cmd) {
+ val = cmd.cheese;
+ });
+
+program.parse(['node', 'test', 'mycommand', '--cheese', '']);
+
+val.should.equal('');
+
diff --git a/test/test.command.allowUnknownOption.js b/test/test.command.allowUnknownOption.js
index 7261dd95a..598d21d4d 100644
--- a/test/test.command.allowUnknownOption.js
+++ b/test/test.command.allowUnknownOption.js
@@ -13,7 +13,7 @@ program
.option('-p, --pepper', 'add pepper');
program.parse('node test -m'.split(' '));
-stubError.callCount.should.equal(3);
+stubError.callCount.should.equal(1);
// test subcommand
@@ -24,7 +24,7 @@ program
});
program.parse('node test sub -m'.split(' '));
-stubError.callCount.should.equal(3);
+stubError.callCount.should.equal(1);
stubExit.calledOnce.should.be.true();
// command with `allowUnknownOption`
diff --git a/test/test.command.executableSubcommand.js b/test/test.command.executableSubcommand.js
index 2dae6b7bf..b9c720c04 100644
--- a/test/test.command.executableSubcommand.js
+++ b/test/test.command.executableSubcommand.js
@@ -34,3 +34,10 @@ var bin = path.join(__dirname, './fixtures/pmlink')
exec(bin + ' install', function (error, stdout, stderr) {
stdout.should.equal('install\n');
});
+
+// when `bin` is a symbol link pointing at a symbolic for mocking global install
+var bin = path.join(__dirname, './fixtures/another-dir/pm')
+// success case
+exec(bin + ' install', function (error, stdout, stderr) {
+ stdout.should.equal('install\n');
+});
diff --git a/test/test.command.executableSubcommand.signals.hup.js b/test/test.command.executableSubcommand.signals.hup.js
new file mode 100644
index 000000000..76b468a0b
--- /dev/null
+++ b/test/test.command.executableSubcommand.signals.hup.js
@@ -0,0 +1,22 @@
+var spawn = require('child_process').spawn,
+ path = require('path'),
+ should = require('should');
+
+var bin = path.join(__dirname, './fixtures/pm');
+var proc = spawn(bin, ['listen'], {});
+
+var output = '';
+proc.stdout.on('data', function (data) {
+ output += data.toString();
+});
+
+// Set a timeout to give 'proc' time to setup completely
+setTimeout(function () {
+ proc.kill('SIGHUP');
+
+ // Set another timeout to give 'prog' time to handle the signal
+ setTimeout(function() {
+ output.should.equal('SIGHUP\n');
+ }, 1000);
+
+}, 2000);
\ No newline at end of file
diff --git a/test/test.command.executableSubcommand.signals.int.js b/test/test.command.executableSubcommand.signals.int.js
new file mode 100644
index 000000000..2dd396652
--- /dev/null
+++ b/test/test.command.executableSubcommand.signals.int.js
@@ -0,0 +1,22 @@
+var spawn = require('child_process').spawn,
+ path = require('path'),
+ should = require('should');
+
+var bin = path.join(__dirname, './fixtures/pm');
+var proc = spawn(bin, ['listen'], {});
+
+var output = '';
+proc.stdout.on('data', function (data) {
+ output += data.toString();
+});
+
+// Set a timeout to give 'proc' time to setup completely
+setTimeout(function () {
+ proc.kill('SIGINT');
+
+ // Set another timeout to give 'prog' time to handle the signal
+ setTimeout(function() {
+ output.should.equal('SIGINT\n');
+ }, 1000);
+
+}, 2000);
\ No newline at end of file
diff --git a/test/test.command.executableSubcommand.signals.term.js b/test/test.command.executableSubcommand.signals.term.js
new file mode 100644
index 000000000..e4449c8bb
--- /dev/null
+++ b/test/test.command.executableSubcommand.signals.term.js
@@ -0,0 +1,22 @@
+var spawn = require('child_process').spawn,
+ path = require('path'),
+ should = require('should');
+
+var bin = path.join(__dirname, './fixtures/pm');
+var proc = spawn(bin, ['listen'], {});
+
+var output = '';
+proc.stdout.on('data', function (data) {
+ output += data.toString();
+});
+
+// Set a timeout to give 'proc' time to setup completely
+setTimeout(function () {
+ proc.kill('SIGTERM');
+
+ // Set another timeout to give 'prog' time to handle the signal
+ setTimeout(function() {
+ output.should.equal('SIGTERM\n');
+ }, 1000);
+
+}, 2000);
\ No newline at end of file
diff --git a/test/test.command.executableSubcommand.signals.usr1.js b/test/test.command.executableSubcommand.signals.usr1.js
new file mode 100644
index 000000000..6a2bbea9c
--- /dev/null
+++ b/test/test.command.executableSubcommand.signals.usr1.js
@@ -0,0 +1,33 @@
+var spawn = require('child_process').spawn,
+ path = require('path'),
+ should = require('should');
+
+var bin = path.join(__dirname, './fixtures/pm');
+var proc = spawn(bin, ['listen'], {});
+
+var output = '';
+proc.stdout.on('data', function (data) {
+ output += data.toString();
+});
+
+// Set a timeout to give 'proc' time to setup completely
+setTimeout(function () {
+ proc.kill('SIGUSR1');
+
+ // Set another timeout to give 'prog' time to handle the signal
+ setTimeout(function() {
+ /*
+ * As described at https://nodejs.org/api/process.html#process_signal_events
+ * this signal will start a debugger and thus the process might output an
+ * additional error message:
+ *
+ * "Failed to open socket on port 5858, waiting 1000 ms before retrying".
+ *
+ * Therefore, we are a bit more lax in matching the output.
+ * It must contain the expected output, meaning an empty line containing
+ * only "SIGUSR1", but any other output is also allowed.
+ */
+ output.should.match(/(^|\n)SIGUSR1\n/);
+ }, 1000);
+
+}, 2000);
\ No newline at end of file
diff --git a/test/test.command.executableSubcommand.signals.usr2.js b/test/test.command.executableSubcommand.signals.usr2.js
new file mode 100644
index 000000000..fb902faa7
--- /dev/null
+++ b/test/test.command.executableSubcommand.signals.usr2.js
@@ -0,0 +1,22 @@
+var spawn = require('child_process').spawn,
+ path = require('path'),
+ should = require('should');
+
+var bin = path.join(__dirname, './fixtures/pm');
+var proc = spawn(bin, ['listen'], {});
+
+var output = '';
+proc.stdout.on('data', function (data) {
+ output += data.toString();
+});
+
+// Set a timeout to give 'proc' time to setup completely
+setTimeout(function () {
+ proc.kill('SIGUSR2');
+
+ // Set another timeout to give 'prog' time to handle the signal
+ setTimeout(function() {
+ output.should.equal('SIGUSR2\n');
+ }, 1000);
+
+}, 2000);
\ No newline at end of file
diff --git a/test/test.command.executableSubcommand.tsnode.js b/test/test.command.executableSubcommand.tsnode.js
new file mode 100644
index 000000000..c7e5524cc
--- /dev/null
+++ b/test/test.command.executableSubcommand.tsnode.js
@@ -0,0 +1,10 @@
+var exec = require('child_process').exec
+ , path = require('path')
+ , should = require('should');
+
+var bin = path.join(__dirname, './fixtures-ts/pm.ts')
+
+// success case
+exec(process.argv[0] + ' -r ts-node/register ' + bin + ' install', function (error, stdout, stderr) {
+ stdout.should.equal('install\n');
+});
diff --git a/test/test.command.executableSubcommandAlias.js b/test/test.command.executableSubcommandAlias.js
index 6d03161eb..0bf1fb0f4 100644
--- a/test/test.command.executableSubcommandAlias.js
+++ b/test/test.command.executableSubcommandAlias.js
@@ -26,3 +26,10 @@ var bin = path.join(__dirname, './fixtures/pmlink')
exec(bin + ' i', function (error, stdout, stderr) {
stdout.should.equal('install\n');
});
+
+// when `bin` is a symbol link pointing at a symbolic for mocking global install
+var bin = path.join(__dirname, './fixtures/another-dir/pm')
+// success case
+exec(bin + ' install', function (error, stdout, stderr) {
+ stdout.should.equal('install\n');
+});
diff --git a/test/test.command.executableSubcommandDefault.js b/test/test.command.executableSubcommandDefault.js
index 36796d867..cf6d773a8 100644
--- a/test/test.command.executableSubcommandDefault.js
+++ b/test/test.command.executableSubcommandDefault.js
@@ -44,3 +44,10 @@ var bin = path.join(__dirname, './fixtures/pmlink')
exec(bin + ' install', function (error, stdout, stderr) {
stdout.should.equal('install\n');
});
+
+// when `bin` is a symbol link pointing at a symbolic for mocking global install
+var bin = path.join(__dirname, './fixtures/another-dir/pm')
+// success case
+exec(bin + ' install', function (error, stdout, stderr) {
+ stdout.should.equal('install\n');
+});
diff --git a/test/test.command.failOnSameAlias.js b/test/test.command.failOnSameAlias.js
new file mode 100644
index 000000000..6b7527631
--- /dev/null
+++ b/test/test.command.failOnSameAlias.js
@@ -0,0 +1,14 @@
+var program = require('../')
+ , should = require('should');
+
+var error;
+
+try {
+ program
+ .command('fail')
+ .alias('fail');
+} catch (e) {
+ error = e;
+}
+
+error.should.deepEqual(new Error('Command alias can\'t be the same as its name'));
diff --git a/test/test.command.help.js b/test/test.command.help.js
index 68973cde6..18a6bc7c3 100644
--- a/test/test.command.help.js
+++ b/test/test.command.help.js
@@ -3,8 +3,10 @@ var program = require('../')
, should = require('should');
-program.command('mycommand [options]');
+program.command('bare');
+
+program.commandHelp().should.equal('Commands:\n bare\n');
-program.parse(['node', 'test']);
+program.command('mycommand [options]');
-program.commandHelp().should.equal('\n Commands:\n\n mycommand [options]\n');
+program.commandHelp().should.equal('Commands:\n bare\n mycommand [options]\n');
diff --git a/test/test.command.helpInformation.js b/test/test.command.helpInformation.js
new file mode 100644
index 000000000..5ec9c3ab8
--- /dev/null
+++ b/test/test.command.helpInformation.js
@@ -0,0 +1,21 @@
+var program = require('../')
+ , sinon = require('sinon').sandbox.create()
+ , should = require('should');
+
+
+program.command('somecommand');
+program.command('anothercommand [options]');
+
+var expectedHelpInformation = [
+ 'Usage: [options] [command]',
+ '',
+ 'Options:',
+ ' -h, --help output usage information',
+ '',
+ 'Commands:',
+ ' somecommand',
+ ' anothercommand [options]',
+ ''
+].join('\n');
+
+program.helpInformation().should.equal(expectedHelpInformation);
diff --git a/test/test.command.name.js b/test/test.command.name.js
index 16e064e46..0d783e9c9 100644
--- a/test/test.command.name.js
+++ b/test/test.command.name.js
@@ -10,7 +10,7 @@ program
program.parse(['node', 'test']);
-program.name.should.be.a.Function;
+program.name.should.be.a.Function();
program.name().should.equal('test');
program.commands[0].name().should.equal('mycommand');
program.commands[1].name().should.equal('help');
@@ -18,7 +18,7 @@ program.commands[1].name().should.equal('help');
var output = process.stdout.write.args[0];
output[0].should.containEql([
- ' mycommand [options] this is my command'
+ ' mycommand [options] this is my command'
].join('\n'));
-sinon.restore();
\ No newline at end of file
+sinon.restore();
diff --git a/test/test.command.name.set.js b/test/test.command.name.set.js
new file mode 100644
index 000000000..a251e67c1
--- /dev/null
+++ b/test/test.command.name.set.js
@@ -0,0 +1,16 @@
+var program = require('../')
+ , sinon = require('sinon').sandbox.create()
+ , should = require('should');
+
+sinon.stub(process, 'exit');
+sinon.stub(process.stdout, 'write');
+
+program.name('foobar').description('This is a test.');
+
+program.name.should.be.a.Function();
+program.name().should.equal('foobar');
+program.description().should.equal('This is a test.');
+
+var output = process.stdout.write.args[0];
+
+sinon.restore();
diff --git a/test/test.command.noConflict.js b/test/test.command.noConflict.js
new file mode 100644
index 000000000..dc772af88
--- /dev/null
+++ b/test/test.command.noConflict.js
@@ -0,0 +1,25 @@
+var program = require('../')
+ , sinon = require('sinon')
+ , should = require('should');
+
+sinon.stub(process, 'exit');
+sinon.stub(process.stdout, 'write');
+
+program
+ .version('0.0.1')
+ .command('version')
+ .action(function() {
+ console.log('Version command invoked');
+ });
+
+program.parse(['node', 'test', 'version']);
+
+var output = process.stdout.write.args[0];
+output[0].should.equal('Version command invoked\n');
+
+program.parse(['node', 'test', '--version']);
+
+var output = process.stdout.write.args[1];
+output[0].should.equal('0.0.1\n');
+
+sinon.restore();
diff --git a/test/test.command.nohelp.js b/test/test.command.nohelp.js
index e8f3d27d4..a56972185 100644
--- a/test/test.command.nohelp.js
+++ b/test/test.command.nohelp.js
@@ -17,19 +17,25 @@ program
.command('hideagain [options]', null, { noHelp: true })
.action(function() { return; });
+program.command('hiddencommandwithoutdescription [options]', { noHelp: true });
+
program.parse(['node', 'test']);
-program.name.should.be.a.Function;
+program.name.should.be.a.Function();
program.name().should.equal('test');
program.commands[0].name().should.equal('mycommand');
program.commands[0]._noHelp.should.be.false();
program.commands[1].name().should.equal('anothercommand');
program.commands[1]._noHelp.should.be.false();
program.commands[2].name().should.equal('hiddencommand');
-program.commands[2]._noHelp.should.be.true;
+program.commands[2]._noHelp.should.be.true();
program.commands[3].name().should.equal('hideagain');
program.commands[3]._noHelp.should.be.true();
-program.commands[4].name().should.equal('help');
+program.commands[4].name().should.equal('hiddencommandwithoutdescription');
+program.commands[4]._noHelp.should.be.true();
+program.commands[5].name().should.equal('help');
+
+
sinon.restore();
sinon.stub(process.stdout, 'write');
@@ -41,10 +47,9 @@ process.stdout.write.args.length.should.equal(1);
var output = process.stdout.write.args[0];
var expect = [
- ' Commands:',
- '',
- ' mycommand [options] this is my command',
- ' anothercommand [options]',
- ' help [cmd] display help for [cmd]'
+ 'Commands:',
+ ' mycommand [options] this is my command',
+ ' anothercommand [options]',
+ ' help [cmd] display help for [cmd]'
].join('\n');
output[0].indexOf(expect).should.not.be.equal(-1);
diff --git a/test/test.commandAsterisk.action.js b/test/test.commandAsterisk.action.js
new file mode 100644
index 000000000..d72381054
--- /dev/null
+++ b/test/test.commandAsterisk.action.js
@@ -0,0 +1,15 @@
+var program = require('../')
+ , should = require('should');
+
+var val = false;
+program
+ .version('0.0.1')
+ .command('*')
+ .description('test')
+ .action(function () {
+ val = true;
+ });
+
+program.parse(['node', 'test']);
+
+val.should.be.false()
diff --git a/test/test.literal.args.js b/test/test.literal.args.js
index 156c42cae..9cc938948 100644
--- a/test/test.literal.args.js
+++ b/test/test.literal.args.js
@@ -11,7 +11,7 @@ program
.option('-b, --bar', 'add some bar');
program.parse(['node', 'test', '--foo', '--', '--bar', 'baz']);
-program.foo.should.be.true;
+program.foo.should.be.true();
should.equal(undefined, program.bar);
program.args.should.eql(['--bar', 'baz']);
diff --git a/test/test.noCommand.action.js b/test/test.noCommand.action.js
new file mode 100644
index 000000000..ae4aecc66
--- /dev/null
+++ b/test/test.noCommand.action.js
@@ -0,0 +1,13 @@
+var program = require('../')
+ , should = require('should');
+
+var val = false;
+program
+ .option('-C, --no-color', 'turn off color output')
+ .action(function () {
+ val = this.color;
+ });
+
+program.parse(['node', 'test']);
+
+program.color.should.equal(val);
diff --git a/test/test.options.args.optional.js b/test/test.options.args.optional.js
index aacaccc9f..d36b384be 100644
--- a/test/test.options.args.optional.js
+++ b/test/test.options.args.optional.js
@@ -10,4 +10,4 @@ program
.option('-c, --cheese [type]', 'optionally specify the type of cheese');
program.parse(['node', 'test', '--cheese']);
-program.cheese.should.be.true;
+program.cheese.should.be.true();
diff --git a/test/test.options.args.required.js b/test/test.options.args.required.js
index f809f3f67..10eebc10b 100644
--- a/test/test.options.args.required.js
+++ b/test/test.options.args.required.js
@@ -14,8 +14,8 @@ console.error = function () {
process.on('exit', function (code) {
code.should.equal(1);
- info.length.should.equal(3);
- info[1].should.equal(" error: option `-c, --cheese ' argument missing");
+ info.length.should.equal(1);
+ info[0].should.equal("error: option `-c, --cheese ' argument missing");
process.exit(0)
});
diff --git a/test/test.options.bool.js b/test/test.options.bool.js
index 338a8caff..508b84b09 100644
--- a/test/test.options.bool.js
+++ b/test/test.options.bool.js
@@ -11,5 +11,5 @@ program
.option('-c, --no-cheese', 'remove cheese');
program.parse(['node', 'test', '--pepper']);
-program.pepper.should.be.true;
-program.cheese.should.be.true;
+program.pepper.should.be.true();
+program.cheese.should.be.true();
diff --git a/test/test.options.bool.no.js b/test/test.options.bool.no.js
index bb7b8993f..c8c954439 100644
--- a/test/test.options.bool.no.js
+++ b/test/test.options.bool.no.js
@@ -12,4 +12,4 @@ program
program.parse(['node', 'test', '--no-cheese']);
should.equal(undefined, program.pepper);
-program.cheese.should.be.false;
+program.cheese.should.be.false();
diff --git a/test/test.options.bool.small.combined.js b/test/test.options.bool.small.combined.js
index 0b1a3bfc1..9ee3a793c 100644
--- a/test/test.options.bool.small.combined.js
+++ b/test/test.options.bool.small.combined.js
@@ -11,5 +11,5 @@ program
.option('-c, --no-cheese', 'remove cheese');
program.parse(['node', 'test', '-pc']);
-program.pepper.should.be.true;
-program.cheese.should.be.false;
+program.pepper.should.be.true();
+program.cheese.should.be.false();
diff --git a/test/test.options.bool.small.js b/test/test.options.bool.small.js
index 2818bfd4c..45c6a76b8 100644
--- a/test/test.options.bool.small.js
+++ b/test/test.options.bool.small.js
@@ -11,5 +11,5 @@ program
.option('-c, --no-cheese', 'remove cheese');
program.parse(['node', 'test', '-p', '-c']);
-program.pepper.should.be.true;
-program.cheese.should.be.false;
+program.pepper.should.be.true();
+program.cheese.should.be.false();
diff --git a/test/test.options.commands.js b/test/test.options.commands.js
index f5c34d2ae..c33d093c0 100644
--- a/test/test.options.commands.js
+++ b/test/test.options.commands.js
@@ -47,15 +47,15 @@ program
program.parse(['node', 'test', '--config', 'conf']);
program.config.should.equal("conf");
-program.commands[0].should.not.have.property.setup_mode;
-program.commands[1].should.not.have.property.exec_mode;
+program.commands[0].should.not.have.property('setup_mode');
+program.commands[1].should.not.have.property('exec_mode');
envValue.should.equal("");
cmdValue.should.equal("");
-program.parse(['node', 'test', '--config', 'conf1', 'setup', '--setup_mode', 'mode3', 'env1']);
+program.parse(['node', 'test', '--config', 'conf1', 'setup', '--setup_mode', 'mode2', 'env1']);
program.config.should.equal("conf1");
-program.commands[0].setup_mode.should.equal("mode3");
-program.commands[0].should.not.have.property.host;
+program.commands[0].setup_mode.should.equal("mode2");
+program.commands[0].should.not.have.property('host');
envValue.should.equal("env1");
program.parse(['node', 'test', '--config', 'conf2', 'setup', '--setup_mode', 'mode3', '-o', 'host1', 'env2']);
@@ -72,7 +72,7 @@ envValue.should.equal("env3");
program.parse(['node', 'test', '--config', 'conf4', 'exec', '--exec_mode', 'mode1', 'exec1']);
program.config.should.equal("conf4");
program.commands[1].exec_mode.should.equal("mode1");
-program.commands[1].should.not.have.property.target;
+program.commands[1].should.not.have.property('target');
cmdValue.should.equal("exec1");
program.parse(['node', 'test', '--config', 'conf5', 'exec', '-e', 'mode2', 'exec2']);
@@ -80,16 +80,17 @@ program.config.should.equal("conf5");
program.commands[1].exec_mode.should.equal("mode2");
cmdValue.should.equal("exec2");
-program.parse(['node', 'test', '--config', 'conf6', 'exec', '--target', 'target1', '-e', 'mode2', 'exec3']);
+program.parse(['node', 'test', '--config', 'conf6', 'exec', '--target', 'target1', '-e', 'mode6', 'exec3']);
program.config.should.equal("conf6");
-program.commands[1].exec_mode.should.equal("mode2");
+program.commands[1].exec_mode.should.equal("mode6");
program.commands[1].target.should.equal("target1");
cmdValue.should.equal("exec3");
+delete program.commands[1].target;
program.parse(['node', 'test', '--config', 'conf7', 'ex', '-e', 'mode3', 'exec4']);
program.config.should.equal("conf7");
program.commands[1].exec_mode.should.equal("mode3");
-program.commands[1].should.not.have.property.target;
+program.commands[1].should.not.have.property('target');
cmdValue.should.equal("exec4");
// Make sure we still catch errors with required values for options
@@ -120,5 +121,5 @@ catch (ex) {
}
process.exit = oldProcessExit;
-exceptionOccurred.should.be.true;
-customHelp.should.be.true;
+exceptionOccurred.should.be.true();
+customHelp.should.be.true();
diff --git a/test/test.options.func.js b/test/test.options.func.js
index 1acb39124..eb8c3bd07 100644
--- a/test/test.options.func.js
+++ b/test/test.options.func.js
@@ -11,13 +11,13 @@ program
.option('-q, --quux ', 'add some quux');
program.parse(['node', 'test', '--foo', '--bar', '--no-magic', '--camel-case', '--quux', 'value']);
-program.opts.should.be.a.Function;
+program.opts.should.be.a.Function();
var opts = program.opts();
-opts.should.be.an.Object;
+opts.should.be.an.Object();
opts.version.should.equal('0.0.1');
-opts.foo.should.be.true;
-opts.bar.should.be.true;
-opts.magic.should.be.false;
-opts.camelCase.should.be.true;
+opts.foo.should.be.true();
+opts.bar.should.be.true();
+opts.magic.should.be.false();
+opts.camelCase.should.be.true();
opts.quux.should.equal('value');
diff --git a/test/test.options.large-only.js b/test/test.options.large-only.js
index 6f7e328f9..4f07ed9d8 100644
--- a/test/test.options.large-only.js
+++ b/test/test.options.large-only.js
@@ -10,4 +10,4 @@ program
.option('--verbose', 'do stuff');
program.parse(['node', 'test', '--verbose']);
-program.verbose.should.be.true;
+program.verbose.should.be.true();
diff --git a/test/test.options.version.custom.js b/test/test.options.version.custom.js
new file mode 100644
index 000000000..9b7d256f8
--- /dev/null
+++ b/test/test.options.version.custom.js
@@ -0,0 +1,20 @@
+var program = require('../')
+ , should = require('should');
+
+var capturedExitCode, capturedOutput, oldProcessExit, oldProcessStdoutWrite;
+
+program.version('0.0.1', '-r, --revision');
+
+['-r', '--revision'].forEach(function (flag) {
+ capturedExitCode = -1;
+ capturedOutput = '';
+ oldProcessExit = process.exit;
+ oldProcessStdoutWrite = process.stdout.write;
+ process.exit = function (code) { capturedExitCode = code; }
+ process.stdout.write = function(output) { capturedOutput += output; }
+ program.parse(['node', 'test', flag]);
+ process.exit = oldProcessExit;
+ process.stdout.write = oldProcessStdoutWrite;
+ capturedOutput.should.equal('0.0.1\n');
+ capturedExitCode.should.equal(0);
+})
diff --git a/test/test.options.version.js b/test/test.options.version.js
new file mode 100644
index 000000000..ae25e84fe
--- /dev/null
+++ b/test/test.options.version.js
@@ -0,0 +1,20 @@
+var program = require('../')
+ , should = require('should');
+
+var capturedExitCode, capturedOutput, oldProcessExit, oldProcessStdoutWrite;
+
+program.version('0.0.1');
+
+['-V', '--version'].forEach(function (flag) {
+ capturedExitCode = -1;
+ capturedOutput = '';
+ oldProcessExit = process.exit;
+ oldProcessStdoutWrite = process.stdout.write;
+ process.exit = function (code) { capturedExitCode = code; }
+ process.stdout.write = function(output) { capturedOutput += output; }
+ program.parse(['node', 'test', flag]);
+ process.exit = oldProcessExit;
+ process.stdout.write = oldProcessStdoutWrite;
+ capturedOutput.should.equal('0.0.1\n');
+ capturedExitCode.should.equal(0);
+})
diff --git a/test/test.variadic.args.js b/test/test.variadic.args.js
index 72cff8ae1..80bdad530 100644
--- a/test/test.variadic.args.js
+++ b/test/test.variadic.args.js
@@ -57,8 +57,4 @@ try {
process.exit = oldProcessExit;
console.error = oldConsoleError;
-[
- '',
- ' error: variadic arguments must be last `variadicArg\'',
- ''
-].join('\n').should.eql(errorMessage);
+'error: variadic arguments must be last `variadicArg\''.should.eql(errorMessage);
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 000000000..dee4c88b9
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": false,
+ "types": [
+ "node"
+ ],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "typings/index.d.ts",
+ "typings/commander-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/typings/commander-tests.ts b/typings/commander-tests.ts
new file mode 100644
index 000000000..474db4e87
--- /dev/null
+++ b/typings/commander-tests.ts
@@ -0,0 +1,99 @@
+import * as program from './index';
+
+interface ExtendedOptions extends program.CommandOptions {
+ isNew: any;
+}
+
+const commandInstance = new program.Command('-f');
+const optionsInstance = new program.Option('-f');
+
+const name = program.name();
+
+program
+ .name('set name')
+ .version('0.0.1')
+ .option('-p, --peppers', 'Add peppers')
+ .option('-P, --pineapple', 'Add pineapple')
+ .option('-b, --bbq', 'Add bbq sauce')
+ .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+ .parse(process.argv);
+
+console.log('you ordered a pizza with:');
+if (program['peppers']) console.log(' - peppers');
+if (program['pineapple']) console.log(' - pineapple');
+if (program['bbq']) console.log(' - bbq');
+console.log(' - %s cheese', program['cheese']);
+
+function range(val: string) {
+ return val.split('..').map(Number);
+}
+
+function list(val: string) {
+ return val.split(',');
+}
+
+function collect(val: string, memo: string[]) {
+ memo.push(val);
+ return memo;
+}
+
+function increaseVerbosity(v: any, total: number) {
+ return total + 1;
+}
+
+program
+ .version('0.0.1')
+ .usage('[options] ')
+ .option('-i, --integer ', 'An integer argument', parseInt)
+ .option('-f, --float ', 'A float argument', parseFloat)
+ .option('-r, --range ..', 'A range', range)
+ .option('-l, --list ', 'A list', list)
+ .option('-o, --optional [value]', 'An optional value')
+ .option('-c, --collect [value]', 'A repeatable value', collect, [])
+ .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
+ .parse(process.argv);
+
+console.log(' int: %j', program['integer']);
+console.log(' float: %j', program['float']);
+console.log(' optional: %j', program['optional']);
+program['range'] = program['range'] || [];
+console.log(' range: %j..%j', program['range'][0], program['range'][1]);
+console.log(' list: %j', program['list']);
+console.log(' collect: %j', program['collect']);
+console.log(' verbosity: %j', program['verbose']);
+console.log(' args: %j', program['args']);
+
+program
+ .version('0.0.1')
+ .option('-f, --foo', 'enable some foo')
+ .option('-b, --bar', 'enable some bar')
+ .option('-B, --baz', 'enable some baz');
+
+// must be before .parse() since
+// node's emit() is immediate
+
+program.on('--help', () => {
+ console.log(' Examples:');
+ console.log('');
+ console.log(' $ custom-help --help');
+ console.log(' $ custom-help -h');
+ console.log('');
+});
+
+program
+ .command('allow-unknown-option')
+ .allowUnknownOption()
+ .action(() => {
+ console.log('unknown option is allowed');
+ });
+
+program
+ .version('0.0.1')
+ .arguments(' [env]')
+ .action((cmd, env) => {
+ console.log(cmd, env);
+ });
+
+program.parse(process.argv);
+
+console.log('stuff');
\ No newline at end of file
diff --git a/typings/index.d.ts b/typings/index.d.ts
new file mode 100644
index 000000000..bcda2771e
--- /dev/null
+++ b/typings/index.d.ts
@@ -0,0 +1,310 @@
+// Type definitions for commander 2.11
+// Project: https://github.com/visionmedia/commander.js
+// Definitions by: Alan Agius , Marcelo Dezem , vvakame , Jules Randolph
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare namespace local {
+
+ class Option {
+ flags: string;
+ required: boolean;
+ optional: boolean;
+ bool: boolean;
+ short?: string;
+ long: string;
+ description: string;
+
+ /**
+ * Initialize a new `Option` with the given `flags` and `description`.
+ *
+ * @param {string} flags
+ * @param {string} [description]
+ */
+ constructor(flags: string, description?: string);
+ }
+
+ class Command extends NodeJS.EventEmitter {
+ [key: string]: any;
+
+ args: string[];
+
+ /**
+ * Initialize a new `Command`.
+ *
+ * @param {string} [name]
+ */
+ constructor(name?: string);
+
+ /**
+ * Set the program version to `str`.
+ *
+ * This method auto-registers the "-V, --version" flag
+ * which will print the version number when passed.
+ *
+ * @param {string} str
+ * @param {string} [flags]
+ * @returns {Command} for chaining
+ */
+ version(str: string, flags?: string): Command;
+
+ /**
+ * Add command `name`.
+ *
+ * The `.action()` callback is invoked when the
+ * command `name` is specified via __ARGV__,
+ * and the remaining arguments are applied to the
+ * function for access.
+ *
+ * When the `name` is "*" an un-matched command
+ * will be passed as the first arg, followed by
+ * the rest of __ARGV__ remaining.
+ *
+ * @example
+ * program
+ * .version('0.0.1')
+ * .option('-C, --chdir ', 'change the working directory')
+ * .option('-c, --config ', 'set config path. defaults to ./deploy.conf')
+ * .option('-T, --no-tests', 'ignore test hook')
+ *
+ * program
+ * .command('setup')
+ * .description('run remote setup commands')
+ * .action(function() {
+ * console.log('setup');
+ * });
+ *
+ * program
+ * .command('exec ')
+ * .description('run the given remote command')
+ * .action(function(cmd) {
+ * console.log('exec "%s"', cmd);
+ * });
+ *
+ * program
+ * .command('teardown [otherDirs...]')
+ * .description('run teardown commands')
+ * .action(function(dir, otherDirs) {
+ * console.log('dir "%s"', dir);
+ * if (otherDirs) {
+ * otherDirs.forEach(function (oDir) {
+ * console.log('dir "%s"', oDir);
+ * });
+ * }
+ * });
+ *
+ * program
+ * .command('*')
+ * .description('deploy the given env')
+ * .action(function(env) {
+ * console.log('deploying "%s"', env);
+ * });
+ *
+ * program.parse(process.argv);
+ *
+ * @param {string} name
+ * @param {string} [desc] for git-style sub-commands
+ * @param {CommandOptions} [opts] command options
+ * @returns {Command} the new command
+ */
+ command(name: string, desc?: string, opts?: commander.CommandOptions): Command;
+
+ /**
+ * Define argument syntax for the top-level command.
+ *
+ * @param {string} desc
+ * @returns {Command} for chaining
+ */
+ arguments(desc: string): Command;
+
+ /**
+ * Parse expected `args`.
+ *
+ * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
+ *
+ * @param {string[]} args
+ * @returns {Command} for chaining
+ */
+ parseExpectedArgs(args: string[]): Command;
+
+ /**
+ * Register callback `fn` for the command.
+ *
+ * @example
+ * program
+ * .command('help')
+ * .description('display verbose help')
+ * .action(function() {
+ * // output help here
+ * });
+ *
+ * @param {(...args: any[]) => void} fn
+ * @returns {Command} for chaining
+ */
+ action(fn: (...args: any[]) => void): Command;
+
+ /**
+ * Define option with `flags`, `description` and optional
+ * coercion `fn`.
+ *
+ * The `flags` string should contain both the short and long flags,
+ * separated by comma, a pipe or space. The following are all valid
+ * all will output this way when `--help` is used.
+ *
+ * "-p, --pepper"
+ * "-p|--pepper"
+ * "-p --pepper"
+ *
+ * @example
+ * // simple boolean defaulting to false
+ * program.option('-p, --pepper', 'add pepper');
+ *
+ * --pepper
+ * program.pepper
+ * // => Boolean
+ *
+ * // simple boolean defaulting to true
+ * program.option('-C, --no-cheese', 'remove cheese');
+ *
+ * program.cheese
+ * // => true
+ *
+ * --no-cheese
+ * program.cheese
+ * // => false
+ *
+ * // required argument
+ * program.option('-C, --chdir ', 'change the working directory');
+ *
+ * --chdir /tmp
+ * program.chdir
+ * // => "/tmp"
+ *
+ * // optional argument
+ * program.option('-c, --cheese [type]', 'add cheese [marble]');
+ *
+ * @param {string} flags
+ * @param {string} [description]
+ * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default
+ * @param {*} [defaultValue]
+ * @returns {Command} for chaining
+ */
+ option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;
+ option(flags: string, description?: string, defaultValue?: any): Command;
+
+ /**
+ * Allow unknown options on the command line.
+ *
+ * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options.
+ * @returns {Command} for chaining
+ */
+ allowUnknownOption(arg?: boolean): Command;
+
+ /**
+ * Parse `argv`, settings options and invoking commands when defined.
+ *
+ * @param {string[]} argv
+ * @returns {Command} for chaining
+ */
+ parse(argv: string[]): Command;
+
+ /**
+ * Parse options from `argv` returning `argv` void of these options.
+ *
+ * @param {string[]} argv
+ * @returns {ParseOptionsResult}
+ */
+ parseOptions(argv: string[]): commander.ParseOptionsResult;
+
+ /**
+ * Return an object containing options as key-value pairs
+ *
+ * @returns {{[key: string]: any}}
+ */
+ opts(): { [key: string]: any };
+
+ /**
+ * Set the description to `str`.
+ *
+ * @param {string} str
+ * @param {{[argName: string]: string}} argsDescription
+ * @return {(Command | string)}
+ */
+ description(str: string, argsDescription?: {[argName: string]: string}): Command;
+ description(): string;
+
+ /**
+ * Set an alias for the command.
+ *
+ * @param {string} alias
+ * @return {(Command | string)}
+ */
+ alias(alias: string): Command;
+ alias(): string;
+
+ /**
+ * Set or get the command usage.
+ *
+ * @param {string} str
+ * @return {(Command | string)}
+ */
+ usage(str: string): Command;
+ usage(): string;
+
+ /**
+ * Set the name of the command.
+ *
+ * @param {string} str
+ * @return {Command}
+ */
+ name(str: string): Command;
+
+ /**
+ * Get the name of the command.
+ *
+ * @return {string}
+ */
+ name(): string;
+
+ /**
+ * Output help information for this command.
+ *
+ * @param {(str: string) => string} [cb]
+ */
+ outputHelp(cb?: (str: string) => string): void;
+
+ /** Output help information and exit.
+ *
+ * @param {(str: string) => string} [cb]
+ */
+ help(cb?: (str: string) => string): never;
+ }
+
+}
+
+declare namespace commander {
+
+ type Command = local.Command
+
+ type Option = local.Option
+
+ interface CommandOptions {
+ noHelp?: boolean;
+ isDefault?: boolean;
+ }
+
+ interface ParseOptionsResult {
+ args: string[];
+ unknown: string[];
+ }
+
+ interface CommanderStatic extends Command {
+ Command: typeof local.Command;
+ Option: typeof local.Option;
+ CommandOptions: CommandOptions;
+ ParseOptionsResult: ParseOptionsResult;
+ }
+
+}
+
+declare const commander: commander.CommanderStatic;
+export = commander;