Merge branch 'master' into master
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by 呼啸随风 · committed by GitHub · parents 2c3cf60, 6e1a979 · Browse files · 58 files·+3913 added−619 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
58 files+3913 added−619 removed
- tests:+434 added−66 removed
- other:+3479 added−553 removed
Provenance
- Commit
66768e7- Tree
8ead571- Author
呼啸随风 <hxsf@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent 1
2c3cf60- Parent 2
6e1a979
58 files changed+3913 added−619 removed
modified:examples/custom-help+3 added-3 removed
14 unmodified lines15 // must be before .parse() since16 // node's emit() is immediate17 18 program.on('--help', function(){19- console.log(' Examples:');19 console.log('');21- console.log(' $ custom-help --help');22- console.log(' $ custom-help -h');20+ console.log('Examples:');21 console.log('');22+ console.log(' $ custom-help --help');23+ console.log(' $ custom-help -h');24 });25 26 program.parse(process.argv);27 1 unmodified linemodified:examples/pm+1 added
2 unmodified lines3 var program = require('..');4 5 program6 .version('0.0.1')7+ .description('Fake package manager')8 .command('install [name]', 'install one or more packages').alias('i')9 .command('search [query]', 'search with optional query').alias('s')10 .command('list', 'list packages installed')11 .command('publish', 'publish the package').alias('p')17 unmodified linesadded:test/fixtures/another-dir/pm+1 added
1+../other-dir/pmadded:test/fixtures/other-dir/pm+1 added
1+../pmmodified:test/fixtures/pm+1 added
6 unmodified lines7 .command('install [name]', 'install one or more packages').alias('i')8 .command('search [query]', 'search with optional query').alias('s')9 .command('cache', 'actions dealing with the cache').alias('c')10 .command('list', 'list packages installed')11+ .command('listen', 'listen for supported signal events').alias('l')12 .command('publish', 'publish or update package').alias('p')13 .command('default', 'default command', {noHelp: true, isDefault: true})14 .parse(process.argv);added:test/fixtures/pm-listen+28 added
1+#!/usr/bin/env node2+3+process.on('SIGUSR1', function(){4+ console.log('SIGUSR1');5+ process.exit();6+});7+8+process.on('SIGUSR2', function(){9+ console.log('SIGUSR2');10+ process.exit();11+});12+13+process.on('SIGTERM', function(){14+ console.log('SIGTERM');15+ process.exit();16+});17+18+process.on('SIGINT', function(){19+ console.log('SIGINT');20+ process.exit();21+});22+23+process.on('SIGHUP', function(){24+ console.log('SIGHUP');25+ process.exit();26+});27+28+setInterval(function(){}, 5000); // Mimic a running processadded:test/fixtures-ts/pm-install.ts+3 added
123#!/usr/bin/env node
console.log('install');added:test/fixtures-ts/pm.ts+8 added
12345678#!/usr/bin/env node
var program = require('../../');
program .version('0.0.1') .command('install [name]', 'install one or more packages') .parse(process.argv);deleted:test/run-16 removed
1-#!/bin/sh2-3-export NODE_ENV=test4-5-echo6-for file in $@; do7- printf "\033[90m ${file#test/}\033[0m "8- node $file 2> /tmp/stderr && echo "\033[36m✓\033[0m"9- code=$?10- if test $code -ne 0; then11- echo "\033[31m✖\033[0m"12- cat /tmp/stderr >&213- exit $code14- fi15-done16-echoadded:test/run.js+22 added
1+#!/usr/bin/env node2+3+const { spawnSync } = require('child_process')4+const { readdirSync } = require('fs')5+const { extname, join } = require('path')6+7+process.env.NODE_ENV = 'test';8+9+process.stdout.write('\n')10+readdirSync(__dirname).forEach((file) => {11+ if (!file.startsWith('test.') || extname(file) !== '.js')12+ return;13+ process.stdout.write(`\x1b[90m ${file}\x1b[0m `);14+ const result = spawnSync(process.argv0, [ join('test', file) ]);15+ if (result.status === 0) {16+ process.stdout.write('\x1b[36m✓\x1b[0m\n');17+ } else {18+ process.stdout.write('\x1b[31m✖\x1b[0m\n');19+ console.error(result.stderr.toString('utf8'));20+ process.exit(result.status);21+ }22+})added:test/test.command.action.emptyOption.js+20 added
1+/**2+ * Module dependencies.3+ */4+5+var program = require('../')6+ , should = require('should');7+8+var val = "some cheese"9+program10+ .name('test')11+ .command('mycommand')12+ .option('-c, --cheese [type]', 'optionally specify the type of cheese')13+ .action(function(cmd) {14+ val = cmd.cheese;15+ });16+17+program.parse(['node', 'test', 'mycommand', '--cheese', '']);18+19+val.should.equal('');20+modified:test/test.command.allowUnknownOption.js+2 added-2 removed
11 unmodified lines12 .version('0.0.1')13 .option('-p, --pepper', 'add pepper');14 program.parse('node test -m'.split(' '));15 16-stubError.callCount.should.equal(3);16+stubError.callCount.should.equal(1);17 18 19 // test subcommand20 resetStubStatus();2 unmodified lines23 .action(function () {24 });25 program.parse('node test sub -m'.split(' '));26 27-stubError.callCount.should.equal(3);27+stubError.callCount.should.equal(1);28 stubExit.calledOnce.should.be.true();29 30 // command with `allowUnknownOption`31 resetStubStatus();27 unmodified linesmodified:test/test.command.executableSubcommand.js+7 added
32 unmodified lines33 // success case34 exec(bin + ' install', function (error, stdout, stderr) {35 stdout.should.equal('install\n');36 });37+38+// when `bin` is a symbol link pointing at a symbolic for mocking global install39+var bin = path.join(__dirname, './fixtures/another-dir/pm')40+// success case41+exec(bin + ' install', function (error, stdout, stderr) {42+ stdout.should.equal('install\n');43+});added:test/test.command.executableSubcommand.signals.hup.js+22 added
1+var spawn = require('child_process').spawn,2+ path = require('path'),3+ should = require('should');4+5+var bin = path.join(__dirname, './fixtures/pm');6+var proc = spawn(bin, ['listen'], {});7+8+var output = '';9+proc.stdout.on('data', function (data) {10+ output += data.toString();11+});12+13+// Set a timeout to give 'proc' time to setup completely14+setTimeout(function () {15+ proc.kill('SIGHUP');16+17+ // Set another timeout to give 'prog' time to handle the signal18+ setTimeout(function() {19+ output.should.equal('SIGHUP\n');20+ }, 1000);21+22+}, 2000);added:test/test.command.executableSubcommand.signals.int.js+22 added
1+var spawn = require('child_process').spawn,2+ path = require('path'),3+ should = require('should');4+5+var bin = path.join(__dirname, './fixtures/pm');6+var proc = spawn(bin, ['listen'], {});7+8+var output = '';9+proc.stdout.on('data', function (data) {10+ output += data.toString();11+});12+13+// Set a timeout to give 'proc' time to setup completely14+setTimeout(function () {15+ proc.kill('SIGINT');16+17+ // Set another timeout to give 'prog' time to handle the signal18+ setTimeout(function() {19+ output.should.equal('SIGINT\n');20+ }, 1000);21+22+}, 2000);added:test/test.command.executableSubcommand.signals.term.js+22 added
1+var spawn = require('child_process').spawn,2+ path = require('path'),3+ should = require('should');4+5+var bin = path.join(__dirname, './fixtures/pm');6+var proc = spawn(bin, ['listen'], {});7+8+var output = '';9+proc.stdout.on('data', function (data) {10+ output += data.toString();11+});12+13+// Set a timeout to give 'proc' time to setup completely14+setTimeout(function () {15+ proc.kill('SIGTERM');16+17+ // Set another timeout to give 'prog' time to handle the signal18+ setTimeout(function() {19+ output.should.equal('SIGTERM\n');20+ }, 1000);21+22+}, 2000);added:test/test.command.executableSubcommand.signals.usr1.js+33 added
1+var spawn = require('child_process').spawn,2+ path = require('path'),3+ should = require('should');4+5+var bin = path.join(__dirname, './fixtures/pm');6+var proc = spawn(bin, ['listen'], {});7+8+var output = '';9+proc.stdout.on('data', function (data) {10+ output += data.toString();11+});12+13+// Set a timeout to give 'proc' time to setup completely14+setTimeout(function () {15+ proc.kill('SIGUSR1');16+17+ // Set another timeout to give 'prog' time to handle the signal18+ setTimeout(function() {19+ /*20+ * As described at https://nodejs.org/api/process.html#process_signal_events21+ * this signal will start a debugger and thus the process might output an22+ * additional error message: 23+ * 24+ * "Failed to open socket on port 5858, waiting 1000 ms before retrying".25+ * 26+ * Therefore, we are a bit more lax in matching the output.27+ * It must contain the expected output, meaning an empty line containing28+ * only "SIGUSR1", but any other output is also allowed.29+ */30+ output.should.match(/(^|\n)SIGUSR1\n/);31+ }, 1000);32+33+}, 2000);added:test/test.command.executableSubcommand.signals.usr2.js+22 added
1+var spawn = require('child_process').spawn,2+ path = require('path'),3+ should = require('should');4+5+var bin = path.join(__dirname, './fixtures/pm');6+var proc = spawn(bin, ['listen'], {});7+8+var output = '';9+proc.stdout.on('data', function (data) {10+ output += data.toString();11+});12+13+// Set a timeout to give 'proc' time to setup completely14+setTimeout(function () {15+ proc.kill('SIGUSR2');16+17+ // Set another timeout to give 'prog' time to handle the signal18+ setTimeout(function() {19+ output.should.equal('SIGUSR2\n');20+ }, 1000);21+22+}, 2000);added:test/test.command.executableSubcommand.tsnode.js+10 added
1+var exec = require('child_process').exec2+ , path = require('path')3+ , should = require('should');4+5+var bin = path.join(__dirname, './fixtures-ts/pm.ts')6+7+// success case8+exec(process.argv[0] + ' -r ts-node/register ' + bin + ' install', function (error, stdout, stderr) {9+ stdout.should.equal('install\n');10+});modified:test/test.command.executableSubcommandAlias.js+7 added
24 unmodified lines25 // success case26 exec(bin + ' i', function (error, stdout, stderr) {27 stdout.should.equal('install\n');28 });29+30+// when `bin` is a symbol link pointing at a symbolic for mocking global install31+var bin = path.join(__dirname, './fixtures/another-dir/pm')32+// success case33+exec(bin + ' install', function (error, stdout, stderr) {34+ stdout.should.equal('install\n');35+});modified:test/test.command.executableSubcommandDefault.js+7 added
42 unmodified lines43 // success case44 exec(bin + ' install', function (error, stdout, stderr) {45 stdout.should.equal('install\n');46 });47+48+// when `bin` is a symbol link pointing at a symbolic for mocking global install49+var bin = path.join(__dirname, './fixtures/another-dir/pm')50+// success case51+exec(bin + ' install', function (error, stdout, stderr) {52+ stdout.should.equal('install\n');53+});added:test/test.command.failOnSameAlias.js+14 added
1+var program = require('../')2+ , should = require('should');3+4+var error;5+6+try {7+ program8+ .command('fail')9+ .alias('fail');10+} catch (e) {11+ error = e;12+}13+14+error.should.deepEqual(new Error('Command alias can\'t be the same as its name'));modified:test/test.command.help.js+5 added-3 removed
1 unmodified line2 , sinon = require('sinon').sandbox.create()3 , should = require('should');4 5 6-program.command('mycommand [options]');6+program.command('bare');7 8-program.parse(['node', 'test']);8+program.commandHelp().should.equal('Commands:\n bare\n');9 10+program.command('mycommand [options]');11+10-program.commandHelp().should.equal('\n Commands:\n\n mycommand [options]\n');12+program.commandHelp().should.equal('Commands:\n bare\n mycommand [options]\n');added:test/test.command.helpInformation.js+21 added
1+var program = require('../')2+ , sinon = require('sinon').sandbox.create()3+ , should = require('should');4+5+6+program.command('somecommand');7+program.command('anothercommand [options]');8+9+var expectedHelpInformation = [10+ 'Usage: [options] [command]',11+ '',12+ 'Options:',13+ ' -h, --help output usage information',14+ '',15+ 'Commands:',16+ ' somecommand',17+ ' anothercommand [options]',18+ ''19+].join('\n');20+21+program.helpInformation().should.equal(expectedHelpInformation);modified:test/test.command.name.js+3 added-3 removed
8 unmodified lines9 .command('mycommand [options]', 'this is my command');10 11 program.parse(['node', 'test']);12 13-program.name.should.be.a.Function;13+program.name.should.be.a.Function();14 program.name().should.equal('test');15 program.commands[0].name().should.equal('mycommand');16 program.commands[1].name().should.equal('help');17 18 var output = process.stdout.write.args[0];19 20 output[0].should.containEql([21- ' mycommand [options] this is my command'21+ ' mycommand [options] this is my command'22 ].join('\n'));23 24-sinon.restore();24+sinon.restore();added:test/test.command.name.set.js+16 added
1+var program = require('../')2+ , sinon = require('sinon').sandbox.create()3+ , should = require('should');4+5+sinon.stub(process, 'exit');6+sinon.stub(process.stdout, 'write');7+8+program.name('foobar').description('This is a test.');9+10+program.name.should.be.a.Function();11+program.name().should.equal('foobar');12+program.description().should.equal('This is a test.');13+14+var output = process.stdout.write.args[0];15+16+sinon.restore();added:test/test.command.noConflict.js+25 added
1+var program = require('../')2+ , sinon = require('sinon')3+ , should = require('should');4+5+sinon.stub(process, 'exit');6+sinon.stub(process.stdout, 'write');7+8+program9+ .version('0.0.1')10+ .command('version')11+ .action(function() {12+ console.log('Version command invoked');13+ });14+15+program.parse(['node', 'test', 'version']);16+17+var output = process.stdout.write.args[0];18+output[0].should.equal('Version command invoked\n');19+20+program.parse(['node', 'test', '--version']);21+22+var output = process.stdout.write.args[1];23+output[0].should.equal('0.0.1\n');24+25+sinon.restore();modified:test/test.command.nohelp.js+13 added-8 removed
15 unmodified lines16 program17 .command('hideagain [options]', null, { noHelp: true })18 .action(function() { return; });19 20+program.command('hiddencommandwithoutdescription [options]', { noHelp: true });21+22 program.parse(['node', 'test']);23 22-program.name.should.be.a.Function;24+program.name.should.be.a.Function();25 program.name().should.equal('test');26 program.commands[0].name().should.equal('mycommand');27 program.commands[0]._noHelp.should.be.false();28 program.commands[1].name().should.equal('anothercommand');29 program.commands[1]._noHelp.should.be.false();30 program.commands[2].name().should.equal('hiddencommand');29-program.commands[2]._noHelp.should.be.true;31+program.commands[2]._noHelp.should.be.true();32 program.commands[3].name().should.equal('hideagain');33 program.commands[3]._noHelp.should.be.true();32-program.commands[4].name().should.equal('help');34+program.commands[4].name().should.equal('hiddencommandwithoutdescription');35+program.commands[4]._noHelp.should.be.true();36+program.commands[5].name().should.equal('help');37 38+39+40 sinon.restore();41 sinon.stub(process.stdout, 'write');42 program.outputHelp();43 2 unmodified lines46 47 var output = process.stdout.write.args[0];48 49 var expect = [44- ' Commands:',45- '',46- ' mycommand [options] this is my command',47- ' anothercommand [options]',48- ' help [cmd] display help for [cmd]'50+ 'Commands:',51+ ' mycommand [options] this is my command',52+ ' anothercommand [options]',53+ ' help [cmd] display help for [cmd]'54 ].join('\n');55 output[0].indexOf(expect).should.not.be.equal(-1);added:test/test.commandAsterisk.action.js+15 added
1+var program = require('../')2+ , should = require('should');3+4+var val = false;5+program6+ .version('0.0.1')7+ .command('*')8+ .description('test')9+ .action(function () {10+ val = true;11+ });12+13+program.parse(['node', 'test']);14+15+val.should.be.false()modified:test/test.literal.args.js+1 added-1 removed
9 unmodified lines10 .option('-f, --foo', 'add some foo')11 .option('-b, --bar', 'add some bar');12 13 program.parse(['node', 'test', '--foo', '--', '--bar', 'baz']);14-program.foo.should.be.true;14+program.foo.should.be.true();15 should.equal(undefined, program.bar);16 program.args.should.eql(['--bar', 'baz']);17 18 // subsequent literals are passed-through as args2 unmodified linesadded:test/test.noCommand.action.js+13 added
1+var program = require('../')2+ , should = require('should');3+4+var val = false;5+program6+ .option('-C, --no-color', 'turn off color output')7+ .action(function () {8+ val = this.color;9+ });10+11+program.parse(['node', 'test']);12+13+program.color.should.equal(val);modified:test/test.options.args.optional.js+1 added-1 removed
8 unmodified lines9 .version('0.0.1')10 .option('-c, --cheese [type]', 'optionally specify the type of cheese');11 12 program.parse(['node', 'test', '--cheese']);13-program.cheese.should.be.true;13+program.cheese.should.be.true();modified:test/test.options.args.required.js+2 added-2 removed
12 unmodified lines13 };14 15 process.on('exit', function (code) {16 code.should.equal(1);17- info.length.should.equal(3);18- info[1].should.equal(" error: option `-c, --cheese <type>' argument missing");17+ info.length.should.equal(1);18+ info[0].should.equal("error: option `-c, --cheese <type>' argument missing");19 process.exit(0)20 });21 22 program4 unmodified linesmodified:test/test.options.bool.js+2 added-2 removed
9 unmodified lines10 .option('-p, --pepper', 'add pepper')11 .option('-c, --no-cheese', 'remove cheese');12 13 program.parse(['node', 'test', '--pepper']);14-program.pepper.should.be.true;15-program.cheese.should.be.true;14+program.pepper.should.be.true();15+program.cheese.should.be.true();modified:test/test.options.bool.no.js+1 added-1 removed
10 unmodified lines11 .option('-c|--no-cheese', 'remove cheese');12 13 program.parse(['node', 'test', '--no-cheese']);14 should.equal(undefined, program.pepper);15-program.cheese.should.be.false;15+program.cheese.should.be.false();modified:test/test.options.bool.small.combined.js+2 added-2 removed
9 unmodified lines10 .option('-p, --pepper', 'add pepper')11 .option('-c, --no-cheese', 'remove cheese');12 13 program.parse(['node', 'test', '-pc']);14-program.pepper.should.be.true;15-program.cheese.should.be.false;14+program.pepper.should.be.true();15+program.cheese.should.be.false();modified:test/test.options.bool.small.js+2 added-2 removed
9 unmodified lines10 .option('-p, --pepper', 'add pepper')11 .option('-c, --no-cheese', 'remove cheese');12 13 program.parse(['node', 'test', '-p', '-c']);14-program.pepper.should.be.true;15-program.cheese.should.be.false;14+program.pepper.should.be.true();15+program.cheese.should.be.false();modified:test/test.options.commands.js+12 added-11 removed
45 unmodified lines46 });47 48 program.parse(['node', 'test', '--config', 'conf']);49 program.config.should.equal("conf");50-program.commands[0].should.not.have.property.setup_mode;51-program.commands[1].should.not.have.property.exec_mode;50+program.commands[0].should.not.have.property('setup_mode');51+program.commands[1].should.not.have.property('exec_mode');52 envValue.should.equal("");53 cmdValue.should.equal("");54 55-program.parse(['node', 'test', '--config', 'conf1', 'setup', '--setup_mode', 'mode3', 'env1']);55+program.parse(['node', 'test', '--config', 'conf1', 'setup', '--setup_mode', 'mode2', 'env1']);56 program.config.should.equal("conf1");57-program.commands[0].setup_mode.should.equal("mode3");58-program.commands[0].should.not.have.property.host;57+program.commands[0].setup_mode.should.equal("mode2");58+program.commands[0].should.not.have.property('host');59 envValue.should.equal("env1");60 61 program.parse(['node', 'test', '--config', 'conf2', 'setup', '--setup_mode', 'mode3', '-o', 'host1', 'env2']);62 program.config.should.equal("conf2");8 unmodified lines71 72 program.parse(['node', 'test', '--config', 'conf4', 'exec', '--exec_mode', 'mode1', 'exec1']);73 program.config.should.equal("conf4");74 program.commands[1].exec_mode.should.equal("mode1");75-program.commands[1].should.not.have.property.target;75+program.commands[1].should.not.have.property('target');76 cmdValue.should.equal("exec1");77 78 program.parse(['node', 'test', '--config', 'conf5', 'exec', '-e', 'mode2', 'exec2']);79 program.config.should.equal("conf5");80 program.commands[1].exec_mode.should.equal("mode2");81 cmdValue.should.equal("exec2");82 83-program.parse(['node', 'test', '--config', 'conf6', 'exec', '--target', 'target1', '-e', 'mode2', 'exec3']);83+program.parse(['node', 'test', '--config', 'conf6', 'exec', '--target', 'target1', '-e', 'mode6', 'exec3']);84 program.config.should.equal("conf6");85-program.commands[1].exec_mode.should.equal("mode2");85+program.commands[1].exec_mode.should.equal("mode6");86 program.commands[1].target.should.equal("target1");87 cmdValue.should.equal("exec3");88 89+delete program.commands[1].target;90 program.parse(['node', 'test', '--config', 'conf7', 'ex', '-e', 'mode3', 'exec4']);91 program.config.should.equal("conf7");92 program.commands[1].exec_mode.should.equal("mode3");92-program.commands[1].should.not.have.property.target;93+program.commands[1].should.not.have.property('target');94 cmdValue.should.equal("exec4");95 96 // Make sure we still catch errors with required values for options97 var exceptionOccurred = false;22 unmodified lines120 catch (ex) {121 }122 123 process.exit = oldProcessExit;123-exceptionOccurred.should.be.true;124-customHelp.should.be.true;124+exceptionOccurred.should.be.true();125+customHelp.should.be.true();modified:test/test.options.func.js+6 added-6 removed
9 unmodified lines10 .option('-c, --camel-case', 'convert to camelCase')11 .option('-q, --quux <quux>', 'add some quux');12 13 program.parse(['node', 'test', '--foo', '--bar', '--no-magic', '--camel-case', '--quux', 'value']);14-program.opts.should.be.a.Function;14+program.opts.should.be.a.Function();15 16 var opts = program.opts();17-opts.should.be.an.Object;17+opts.should.be.an.Object();18 opts.version.should.equal('0.0.1');19-opts.foo.should.be.true;20-opts.bar.should.be.true;21-opts.magic.should.be.false;22-opts.camelCase.should.be.true;19+opts.foo.should.be.true();20+opts.bar.should.be.true();21+opts.magic.should.be.false();22+opts.camelCase.should.be.true();23 opts.quux.should.equal('value');modified:test/test.options.large-only.js+1 added-1 removed
8 unmodified lines9 .version('0.0.1')10 .option('--verbose', 'do stuff');11 12 program.parse(['node', 'test', '--verbose']);13-program.verbose.should.be.true;13+program.verbose.should.be.true();added:test/test.options.version.custom.js+20 added
1+var program = require('../')2+ , should = require('should');3+4+var capturedExitCode, capturedOutput, oldProcessExit, oldProcessStdoutWrite;5+6+program.version('0.0.1', '-r, --revision');7+8+['-r', '--revision'].forEach(function (flag) {9+ capturedExitCode = -1;10+ capturedOutput = '';11+ oldProcessExit = process.exit;12+ oldProcessStdoutWrite = process.stdout.write;13+ process.exit = function (code) { capturedExitCode = code; }14+ process.stdout.write = function(output) { capturedOutput += output; }15+ program.parse(['node', 'test', flag]);16+ process.exit = oldProcessExit;17+ process.stdout.write = oldProcessStdoutWrite;18+ capturedOutput.should.equal('0.0.1\n');19+ capturedExitCode.should.equal(0);20+})added:test/test.options.version.js+20 added
1+var program = require('../')2+ , should = require('should');3+4+var capturedExitCode, capturedOutput, oldProcessExit, oldProcessStdoutWrite;5+6+program.version('0.0.1');7+8+['-V', '--version'].forEach(function (flag) {9+ capturedExitCode = -1;10+ capturedOutput = '';11+ oldProcessExit = process.exit;12+ oldProcessStdoutWrite = process.stdout.write;13+ process.exit = function (code) { capturedExitCode = code; }14+ process.stdout.write = function(output) { capturedOutput += output; }15+ program.parse(['node', 'test', flag]);16+ process.exit = oldProcessExit;17+ process.stdout.write = oldProcessStdoutWrite;18+ capturedOutput.should.equal('0.0.1\n');19+ capturedExitCode.should.equal(0);20+})modified:test/test.variadic.args.js+1 added-5 removed
55 unmodified lines56 57 process.exit = oldProcessExit;58 console.error = oldConsoleError;59 60-[61- '',62- ' error: variadic arguments must be last `variadicArg\'',60+'error: variadic arguments must be last `variadicArg\''.should.eql(errorMessage);63- ''64-].join('\n').should.eql(errorMessage);added:typings/commander-tests.ts+99 added
1+import * as program from './index';2+3+interface ExtendedOptions extends program.CommandOptions {4+ isNew: any;5+}6+7+const commandInstance = new program.Command('-f');8+const optionsInstance = new program.Option('-f');9+10+const name = program.name();11+12+program13+ .name('set name')14+ .version('0.0.1')15+ .option('-p, --peppers', 'Add peppers')16+ .option('-P, --pineapple', 'Add pineapple')17+ .option('-b, --bbq', 'Add bbq sauce')18+ .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')19+ .parse(process.argv);20+21+console.log('you ordered a pizza with:');22+if (program['peppers']) console.log(' - peppers');23+if (program['pineapple']) console.log(' - pineapple');24+if (program['bbq']) console.log(' - bbq');25+console.log(' - %s cheese', program['cheese']);26+27+function range(val: string) {28+ return val.split('..').map(Number);29+}30+31+function list(val: string) {32+ return val.split(',');33+}34+35+function collect(val: string, memo: string[]) {36+ memo.push(val);37+ return memo;38+}39+40+function increaseVerbosity(v: any, total: number) {41+ return total + 1;42+}43+44+program45+ .version('0.0.1')46+ .usage('[options] <file ...>')47+ .option('-i, --integer <n>', 'An integer argument', parseInt)48+ .option('-f, --float <n>', 'A float argument', parseFloat)49+ .option('-r, --range <a>..<b>', 'A range', range)50+ .option('-l, --list <items>', 'A list', list)51+ .option('-o, --optional [value]', 'An optional value')52+ .option('-c, --collect [value]', 'A repeatable value', collect, [])53+ .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)54+ .parse(process.argv);55+56+console.log(' int: %j', program['integer']);57+console.log(' float: %j', program['float']);58+console.log(' optional: %j', program['optional']);59+program['range'] = program['range'] || [];60+console.log(' range: %j..%j', program['range'][0], program['range'][1]);61+console.log(' list: %j', program['list']);62+console.log(' collect: %j', program['collect']);63+console.log(' verbosity: %j', program['verbose']);64+console.log(' args: %j', program['args']);65+66+program67+ .version('0.0.1')68+ .option('-f, --foo', 'enable some foo')69+ .option('-b, --bar', 'enable some bar')70+ .option('-B, --baz', 'enable some baz');71+72+// must be before .parse() since73+// node's emit() is immediate74+75+program.on('--help', () => {76+ console.log(' Examples:');77+ console.log('');78+ console.log(' $ custom-help --help');79+ console.log(' $ custom-help -h');80+ console.log('');81+});82+83+program84+ .command('allow-unknown-option')85+ .allowUnknownOption()86+ .action(() => {87+ console.log('unknown option is allowed');88+ });89+90+program91+ .version('0.0.1')92+ .arguments('<cmd> [env]')93+ .action((cmd, env) => {94+ console.log(cmd, env);95+ });96+97+program.parse(process.argv);98+99+console.log('stuff');added:typings/index.d.ts+310 added
1+// Type definitions for commander 2.112+// Project: https://github.com/visionmedia/commander.js3+// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>4+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped5+6+declare namespace local {7+8+ class Option {9+ flags: string;10+ required: boolean;11+ optional: boolean;12+ bool: boolean;13+ short?: string;14+ long: string;15+ description: string;16+17+ /**18+ * Initialize a new `Option` with the given `flags` and `description`.19+ *20+ * @param {string} flags21+ * @param {string} [description]22+ */23+ constructor(flags: string, description?: string);24+ }25+26+ class Command extends NodeJS.EventEmitter {27+ [key: string]: any;28+29+ args: string[];30+31+ /**32+ * Initialize a new `Command`.33+ *34+ * @param {string} [name]35+ */36+ constructor(name?: string);37+38+ /**39+ * Set the program version to `str`.40+ *41+ * This method auto-registers the "-V, --version" flag42+ * which will print the version number when passed.43+ *44+ * @param {string} str45+ * @param {string} [flags]46+ * @returns {Command} for chaining47+ */48+ version(str: string, flags?: string): Command;49+50+ /**51+ * Add command `name`.52+ *53+ * The `.action()` callback is invoked when the54+ * command `name` is specified via __ARGV__,55+ * and the remaining arguments are applied to the56+ * function for access.57+ *58+ * When the `name` is "*" an un-matched command59+ * will be passed as the first arg, followed by60+ * the rest of __ARGV__ remaining.61+ *62+ * @example63+ * program64+ * .version('0.0.1')65+ * .option('-C, --chdir <path>', 'change the working directory')66+ * .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')67+ * .option('-T, --no-tests', 'ignore test hook')68+ *69+ * program70+ * .command('setup')71+ * .description('run remote setup commands')72+ * .action(function() {73+ * console.log('setup');74+ * });75+ *76+ * program77+ * .command('exec <cmd>')78+ * .description('run the given remote command')79+ * .action(function(cmd) {80+ * console.log('exec "%s"', cmd);81+ * });82+ *83+ * program84+ * .command('teardown <dir> [otherDirs...]')85+ * .description('run teardown commands')86+ * .action(function(dir, otherDirs) {87+ * console.log('dir "%s"', dir);88+ * if (otherDirs) {89+ * otherDirs.forEach(function (oDir) {90+ * console.log('dir "%s"', oDir);91+ * });92+ * }93+ * });94+ *95+ * program96+ * .command('*')97+ * .description('deploy the given env')98+ * .action(function(env) {99+ * console.log('deploying "%s"', env);100+ * });101+ *102+ * program.parse(process.argv);103+ *104+ * @param {string} name105+ * @param {string} [desc] for git-style sub-commands106+ * @param {CommandOptions} [opts] command options107+ * @returns {Command} the new command108+ */109+ command(name: string, desc?: string, opts?: commander.CommandOptions): Command;110+111+ /**112+ * Define argument syntax for the top-level command.113+ *114+ * @param {string} desc115+ * @returns {Command} for chaining116+ */117+ arguments(desc: string): Command;118+119+ /**120+ * Parse expected `args`.121+ *122+ * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.123+ *124+ * @param {string[]} args125+ * @returns {Command} for chaining126+ */127+ parseExpectedArgs(args: string[]): Command;128+129+ /**130+ * Register callback `fn` for the command.131+ *132+ * @example133+ * program134+ * .command('help')135+ * .description('display verbose help')136+ * .action(function() {137+ * // output help here138+ * });139+ *140+ * @param {(...args: any[]) => void} fn141+ * @returns {Command} for chaining142+ */143+ action(fn: (...args: any[]) => void): Command;144+145+ /**146+ * Define option with `flags`, `description` and optional147+ * coercion `fn`.148+ *149+ * The `flags` string should contain both the short and long flags,150+ * separated by comma, a pipe or space. The following are all valid151+ * all will output this way when `--help` is used.152+ *153+ * "-p, --pepper"154+ * "-p|--pepper"155+ * "-p --pepper"156+ *157+ * @example158+ * // simple boolean defaulting to false159+ * program.option('-p, --pepper', 'add pepper');160+ *161+ * --pepper162+ * program.pepper163+ * // => Boolean164+ *165+ * // simple boolean defaulting to true166+ * program.option('-C, --no-cheese', 'remove cheese');167+ *168+ * program.cheese169+ * // => true170+ *171+ * --no-cheese172+ * program.cheese173+ * // => false174+ *175+ * // required argument176+ * program.option('-C, --chdir <path>', 'change the working directory');177+ *178+ * --chdir /tmp179+ * program.chdir180+ * // => "/tmp"181+ *182+ * // optional argument183+ * program.option('-c, --cheese [type]', 'add cheese [marble]');184+ *185+ * @param {string} flags186+ * @param {string} [description]187+ * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default188+ * @param {*} [defaultValue]189+ * @returns {Command} for chaining190+ */191+ option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;192+ option(flags: string, description?: string, defaultValue?: any): Command;193+194+ /**195+ * Allow unknown options on the command line.196+ *197+ * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options.198+ * @returns {Command} for chaining199+ */200+ allowUnknownOption(arg?: boolean): Command;201+202+ /**203+ * Parse `argv`, settings options and invoking commands when defined.204+ *205+ * @param {string[]} argv206+ * @returns {Command} for chaining207+ */208+ parse(argv: string[]): Command;209+210+ /**211+ * Parse options from `argv` returning `argv` void of these options.212+ *213+ * @param {string[]} argv214+ * @returns {ParseOptionsResult}215+ */216+ parseOptions(argv: string[]): commander.ParseOptionsResult;217+218+ /**219+ * Return an object containing options as key-value pairs220+ *221+ * @returns {{[key: string]: any}}222+ */223+ opts(): { [key: string]: any };224+225+ /**226+ * Set the description to `str`.227+ *228+ * @param {string} str229+ * @param {{[argName: string]: string}} argsDescription230+ * @return {(Command | string)}231+ */232+ description(str: string, argsDescription?: {[argName: string]: string}): Command;233+ description(): string;234+235+ /**236+ * Set an alias for the command.237+ *238+ * @param {string} alias239+ * @return {(Command | string)}240+ */241+ alias(alias: string): Command;242+ alias(): string;243+244+ /**245+ * Set or get the command usage.246+ *247+ * @param {string} str248+ * @return {(Command | string)}249+ */250+ usage(str: string): Command;251+ usage(): string;252+253+ /**254+ * Set the name of the command.255+ *256+ * @param {string} str257+ * @return {Command}258+ */259+ name(str: string): Command;260+261+ /**262+ * Get the name of the command.263+ *264+ * @return {string}265+ */266+ name(): string;267+268+ /**269+ * Output help information for this command.270+ *271+ * @param {(str: string) => string} [cb]272+ */273+ outputHelp(cb?: (str: string) => string): void;274+275+ /** Output help information and exit.276+ *277+ * @param {(str: string) => string} [cb]278+ */279+ help(cb?: (str: string) => string): never;280+ }281+282+}283+284+declare namespace commander {285+286+ type Command = local.Command287+288+ type Option = local.Option289+290+ interface CommandOptions {291+ noHelp?: boolean;292+ isDefault?: boolean;293+ }294+295+ interface ParseOptionsResult {296+ args: string[];297+ unknown: string[];298+ }299+300+ interface CommanderStatic extends Command {301+ Command: typeof local.Command;302+ Option: typeof local.Option;303+ CommandOptions: CommandOptions;304+ ParseOptionsResult: ParseOptionsResult;305+ }306+307+}308+309+declare const commander: commander.CommanderStatic;310+export = commander;added:.editorconfig+12 added
1+# EditorConfig is awesome: http://EditorConfig.org2+3+# top-most EditorConfig file4+root = true5+6+[*]7+end_of_line = lf8+insert_final_newline = true9+indent_style = space10+indent_size = 211+tab_width = 212+# trim_trailing_whitespace = trueadded:.eslintrc.json+8 added
1+{2+ "extends": "standard",3+ "rules": {4+ "one-var": "off",5+ "semi": ["error", "always"],6+ "space-before-function-paren": ["error", "never"]7+ }8+}modified:.gitignore+1 added
1 .DS_Store2 node_modules3 *.sock4 .idea5+.vscode/modified:.travis.yml+9 added-10 removed
1 language: node_js2 sudo: false3 node_js:4- - "0.6"5- - "0.8"6- - "0.10"7- - "0.12"8- - "io.js"9- - "2"10- - "3"11- - "4"12- - "6"13- - "node"4+- "6"5+- "8"6+- "10"7+cache:8+ directories:9+ - "node_modules"10+script:11+- npm run lint12+- npm testadded:CHANGELOG.md+408 added
1+2+2.20.0 / 2019-04-023+==================4+5+ * fix: resolve symbolic links completely when hunting for subcommands (#935)6+ * Update index.d.ts (#930)7+ * Update Readme.md (#924)8+ * Remove --save option as it isn't required anymore (#918)9+ * Add link to the license file (#900)10+ * Added example of receiving args from options (#858)11+ * Added missing semicolon (#882)12+ * Add extension to .eslintrc (#876)13+14+2.19.0 / 2018-10-0215+==================16+17+ * Removed newline after Options and Commands headers (#864)18+ * Bugfix - Error output (#862)19+ * Fix to change default value to string (#856)20+21+2.18.0 / 2018-09-0722+==================23+24+ * Standardize help output (#853)25+ * chmod 644 travis.yml (#851)26+ * add support for execute typescript subcommand via ts-node (#849)27+28+2.17.1 / 2018-08-0729+==================30+31+ * Fix bug in command emit (#844)32+33+2.17.0 / 2018-08-0334+==================35+36+ * fixed newline output after help information (#833)37+ * Fix to emit the action even without command (#778)38+ * npm update (#823)39+40+2.16.0 / 2018-06-2941+==================42+43+ * Remove Makefile and `test/run` (#821)44+ * Make 'npm test' run on Windows (#820)45+ * Add badge to display install size (#807)46+ * chore: cache node_modules (#814)47+ * chore: remove Node.js 4 (EOL), add Node.js 10 (#813)48+ * fixed typo in readme (#812)49+ * Fix types (#804)50+ * Update eslint to resolve vulnerabilities in lodash (#799)51+ * updated readme with custom event listeners. (#791)52+ * fix tests (#794)53+54+2.15.0 / 2018-03-0755+==================56+57+ * Update downloads badge to point to graph of downloads over time instead of duplicating link to npm58+ * Arguments description59+60+2.14.1 / 2018-02-0761+==================62+63+ * Fix typing of help function64+65+2.14.0 / 2018-02-0566+==================67+68+ * only register the option:version event once69+ * Fixes issue #727: Passing empty string for option on command is set to undefined70+ * enable eqeqeq rule71+ * resolves #754 add linter configuration to project72+ * resolves #560 respect custom name for version option73+ * document how to override the version flag74+ * document using options per command75+76+2.13.0 / 2018-01-0977+==================78+79+ * Do not print default for --no-80+ * remove trailing spaces in command help81+ * Update CI's Node.js to LTS and latest version82+ * typedefs: Command and Option types added to commander namespace83+84+2.12.2 / 2017-11-2885+==================86+87+ * fix: typings are not shipped88+89+2.12.1 / 2017-11-2390+==================91+92+ * Move @types/node to dev dependency93+94+2.12.0 / 2017-11-2295+==================96+97+ * add attributeName() method to Option objects98+ * Documentation updated for options with --no prefix99+ * typings: `outputHelp` takes a string as the first parameter100+ * typings: use overloads101+ * feat(typings): update to match js api102+ * Print default value in option help103+ * Fix translation error104+ * Fail when using same command and alias (#491)105+ * feat(typings): add help callback106+ * fix bug when description is add after command with options (#662)107+ * Format js code108+ * Rename History.md to CHANGELOG.md (#668)109+ * feat(typings): add typings to support TypeScript (#646)110+ * use current node111+112+2.11.0 / 2017-07-03113+==================114+115+ * Fix help section order and padding (#652)116+ * feature: support for signals to subcommands (#632)117+ * Fixed #37, --help should not display first (#447)118+ * Fix translation errors. (#570)119+ * Add package-lock.json120+ * Remove engines121+ * Upgrade package version122+ * Prefix events to prevent conflicts between commands and options (#494)123+ * Removing dependency on graceful-readlink124+ * Support setting name in #name function and make it chainable125+ * Add .vscode directory to .gitignore (Visual Studio Code metadata)126+ * Updated link to ruby commander in readme files127+128+2.10.0 / 2017-06-19129+==================130+131+ * Update .travis.yml. drop support for older node.js versions.132+ * Fix require arguments in README.md133+ * On SemVer you do not start from 0.0.1134+ * Add missing semi colon in readme135+ * Add save param to npm install136+ * node v6 travis test137+ * Update Readme_zh-CN.md138+ * Allow literal '--' to be passed-through as an argument139+ * Test subcommand alias help140+ * link build badge to master branch141+ * Support the alias of Git style sub-command142+ * added keyword commander for better search result on npm143+ * Fix Sub-Subcommands144+ * test node.js stable145+ * Fixes TypeError when a command has an option called `--description`146+ * Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.147+ * Add chinese Readme file148+149+2.9.0 / 2015-10-13150+==================151+152+ * Add option `isDefault` to set default subcommand #415 @Qix-153+ * Add callback to allow filtering or post-processing of help text #434 @djulien154+ * Fix `undefined` text in help information close #414 #416 @zhiyelee155+156+2.8.1 / 2015-04-22157+==================158+159+ * Back out `support multiline description` Close #396 #397160+161+2.8.0 / 2015-04-07162+==================163+164+ * Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee165+ * Fix bug in Git-style sub-commands #372 @zhiyelee166+ * Allow commands to be hidden from help #383 @tonylukasavage167+ * When git-style sub-commands are in use, yet none are called, display help #382 @claylo168+ * Add ability to specify arguments syntax for top-level command #258 @rrthomas169+ * Support multiline descriptions #208 @zxqfox170+171+2.7.1 / 2015-03-11172+==================173+174+ * Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.175+176+2.7.0 / 2015-03-09177+==================178+179+ * Fix git-style bug when installed globally. Close #335 #349 @zhiyelee180+ * Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage181+ * Add support for camelCase on `opts()`. Close #353 @nkzawa182+ * Add node.js 0.12 and io.js to travis.yml183+ * Allow RegEx options. #337 @palanik184+ * Fixes exit code when sub-command failing. Close #260 #332 @pirelenito185+ * git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee186+187+2.6.0 / 2014-12-30188+==================189+190+ * added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee191+ * Add application description to the help msg. Close #112 @dalssoft192+193+2.5.1 / 2014-12-15194+==================195+196+ * fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee197+198+2.5.0 / 2014-10-24199+==================200+201+ * add support for variadic arguments. Closes #277 @whitlockjc202+203+2.4.0 / 2014-10-17204+==================205+206+ * fixed a bug on executing the coercion function of subcommands option. Closes #270207+ * added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage208+ * added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage209+ * fixed a bug on subcommand name. Closes #248 @jonathandelgado210+ * fixed function normalize doesn’t honor option terminator. Closes #216 @abbr211+212+2.3.0 / 2014-07-16213+==================214+215+ * add command alias'. Closes PR #210216+ * fix: Typos. Closes #99217+ * fix: Unused fs module. Closes #217218+219+2.2.0 / 2014-03-29220+==================221+222+ * add passing of previous option value223+ * fix: support subcommands on windows. Closes #142224+ * Now the defaultValue passed as the second argument of the coercion function.225+226+2.1.0 / 2013-11-21227+==================228+229+ * add: allow cflag style option params, unit test, fixes #174230+231+2.0.0 / 2013-07-18232+==================233+234+ * remove input methods (.prompt, .confirm, etc)235+236+1.3.2 / 2013-07-18237+==================238+239+ * add support for sub-commands to co-exist with the original command240+241+1.3.1 / 2013-07-18242+==================243+244+ * add quick .runningCommand hack so you can opt-out of other logic when running a sub command245+246+1.3.0 / 2013-07-09247+==================248+249+ * add EACCES error handling250+ * fix sub-command --help251+252+1.2.0 / 2013-06-13253+==================254+255+ * allow "-" hyphen as an option argument256+ * support for RegExp coercion257+258+1.1.1 / 2012-11-20259+==================260+261+ * add more sub-command padding262+ * fix .usage() when args are present. Closes #106263+264+1.1.0 / 2012-11-16265+==================266+267+ * add git-style executable subcommand support. Closes #94268+269+1.0.5 / 2012-10-09270+==================271+272+ * fix `--name` clobbering. Closes #92273+ * fix examples/help. Closes #89274+275+1.0.4 / 2012-09-03276+==================277+278+ * add `outputHelp()` method.279+280+1.0.3 / 2012-08-30281+==================282+283+ * remove invalid .version() defaulting284+285+1.0.2 / 2012-08-24286+==================287+288+ * add `--foo=bar` support [arv]289+ * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]290+291+1.0.1 / 2012-08-03292+==================293+294+ * fix issue #56295+ * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())296+297+1.0.0 / 2012-07-05298+==================299+300+ * add support for optional option descriptions301+ * add defaulting of `.version()` to package.json's version302+303+0.6.1 / 2012-06-01304+==================305+306+ * Added: append (yes or no) on confirmation307+ * Added: allow node.js v0.7.x308+309+0.6.0 / 2012-04-10310+==================311+312+ * Added `.prompt(obj, callback)` support. Closes #49313+ * Added default support to .choose(). Closes #41314+ * Fixed the choice example315+316+0.5.1 / 2011-12-20317+==================318+319+ * Fixed `password()` for recent nodes. Closes #36320+321+0.5.0 / 2011-12-04322+==================323+324+ * Added sub-command option support [itay]325+326+0.4.3 / 2011-12-04327+==================328+329+ * Fixed custom help ordering. Closes #32330+331+0.4.2 / 2011-11-24332+==================333+334+ * Added travis support335+ * Fixed: line-buffered input automatically trimmed. Closes #31336+337+0.4.1 / 2011-11-18338+==================339+340+ * Removed listening for "close" on --help341+342+0.4.0 / 2011-11-15343+==================344+345+ * Added support for `--`. Closes #24346+347+0.3.3 / 2011-11-14348+==================349+350+ * Fixed: wait for close event when writing help info [Jerry Hamlet]351+352+0.3.2 / 2011-11-01353+==================354+355+ * Fixed long flag definitions with values [felixge]356+357+0.3.1 / 2011-10-31358+==================359+360+ * Changed `--version` short flag to `-V` from `-v`361+ * Changed `.version()` so it's configurable [felixge]362+363+0.3.0 / 2011-10-31364+==================365+366+ * Added support for long flags only. Closes #18367+368+0.2.1 / 2011-10-24369+==================370+371+ * "node": ">= 0.4.x < 0.7.0". Closes #20372+373+0.2.0 / 2011-09-26374+==================375+376+ * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]377+378+0.1.0 / 2011-08-24379+==================380+381+ * Added support for custom `--help` output382+383+0.0.5 / 2011-08-18384+==================385+386+ * Changed: when the user enters nothing prompt for password again387+ * Fixed issue with passwords beginning with numbers [NuckChorris]388+389+0.0.4 / 2011-08-15390+==================391+392+ * Fixed `Commander#args`393+394+0.0.3 / 2011-08-15395+==================396+397+ * Added default option value support398+399+0.0.2 / 2011-08-15400+==================401+402+ * Added mask support to `Command#password(str[, mask], fn)`403+ * Added `Command#password(str, fn)`404+405+0.0.1 / 2010-01-03406+==================407+408+ * Initial releasedeleted:History.md-261 removed
1-2-2.9.0 / 2015-10-133-==================4-5- * Add option `isDefault` to set default subcommand #415 @Qix-6- * Add callback to allow filtering or post-processing of help text #434 @djulien7- * Fix `undefined` text in help information close #414 #416 @zhiyelee8-9-2.8.1 / 2015-04-2210-==================11-12- * Back out `support multiline description` Close #396 #39713-14-2.8.0 / 2015-04-0715-==================16-17- * Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee18- * Fix bug in Git-style sub-commands #372 @zhiyelee19- * Allow commands to be hidden from help #383 @tonylukasavage20- * When git-style sub-commands are in use, yet none are called, display help #382 @claylo21- * Add ability to specify arguments syntax for top-level command #258 @rrthomas22- * Support multiline descriptions #208 @zxqfox23-24-2.7.1 / 2015-03-1125-==================26-27- * Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.28-29-2.7.0 / 2015-03-0930-==================31-32- * Fix git-style bug when installed globally. Close #335 #349 @zhiyelee33- * Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage34- * Add support for camelCase on `opts()`. Close #353 @nkzawa35- * Add node.js 0.12 and io.js to travis.yml36- * Allow RegEx options. #337 @palanik37- * Fixes exit code when sub-command failing. Close #260 #332 @pirelenito38- * git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee39-40-2.6.0 / 2014-12-3041-==================42-43- * added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee44- * Add application description to the help msg. Close #112 @dalssoft45-46-2.5.1 / 2014-12-1547-==================48-49- * fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee50-51-2.5.0 / 2014-10-2452-==================53-54- * add support for variadic arguments. Closes #277 @whitlockjc55-56-2.4.0 / 2014-10-1757-==================58-59- * fixed a bug on executing the coercion function of subcommands option. Closes #27060- * added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage61- * added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage62- * fixed a bug on subcommand name. Closes #248 @jonathandelgado63- * fixed function normalize doesn’t honor option terminator. Closes #216 @abbr64-65-2.3.0 / 2014-07-1666-==================67-68- * add command alias'. Closes PR #21069- * fix: Typos. Closes #9970- * fix: Unused fs module. Closes #21771-72-2.2.0 / 2014-03-2973-==================74-75- * add passing of previous option value76- * fix: support subcommands on windows. Closes #14277- * Now the defaultValue passed as the second argument of the coercion function.78-79-2.1.0 / 2013-11-2180-==================81-82- * add: allow cflag style option params, unit test, fixes #17483-84-2.0.0 / 2013-07-1885-==================86-87- * remove input methods (.prompt, .confirm, etc)88-89-1.3.2 / 2013-07-1890-==================91-92- * add support for sub-commands to co-exist with the original command93-94-1.3.1 / 2013-07-1895-==================96-97- * add quick .runningCommand hack so you can opt-out of other logic when running a sub command98-99-1.3.0 / 2013-07-09100-==================101-102- * add EACCES error handling103- * fix sub-command --help104-105-1.2.0 / 2013-06-13106-==================107-108- * allow "-" hyphen as an option argument109- * support for RegExp coercion110-111-1.1.1 / 2012-11-20112-==================113-114- * add more sub-command padding115- * fix .usage() when args are present. Closes #106116-117-1.1.0 / 2012-11-16118-==================119-120- * add git-style executable subcommand support. Closes #94121-122-1.0.5 / 2012-10-09123-==================124-125- * fix `--name` clobbering. Closes #92126- * fix examples/help. Closes #89127-128-1.0.4 / 2012-09-03129-==================130-131- * add `outputHelp()` method.132-133-1.0.3 / 2012-08-30134-==================135-136- * remove invalid .version() defaulting137-138-1.0.2 / 2012-08-24139-==================140-141- * add `--foo=bar` support [arv]142- * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]143-144-1.0.1 / 2012-08-03145-==================146-147- * fix issue #56148- * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())149-150-1.0.0 / 2012-07-05151-==================152-153- * add support for optional option descriptions154- * add defaulting of `.version()` to package.json's version155-156-0.6.1 / 2012-06-01157-==================158-159- * Added: append (yes or no) on confirmation160- * Added: allow node.js v0.7.x161-162-0.6.0 / 2012-04-10163-==================164-165- * Added `.prompt(obj, callback)` support. Closes #49166- * Added default support to .choose(). Closes #41167- * Fixed the choice example168-169-0.5.1 / 2011-12-20170-==================171-172- * Fixed `password()` for recent nodes. Closes #36173-174-0.5.0 / 2011-12-04175-==================176-177- * Added sub-command option support [itay]178-179-0.4.3 / 2011-12-04180-==================181-182- * Fixed custom help ordering. Closes #32183-184-0.4.2 / 2011-11-24185-==================186-187- * Added travis support188- * Fixed: line-buffered input automatically trimmed. Closes #31189-190-0.4.1 / 2011-11-18191-==================192-193- * Removed listening for "close" on --help194-195-0.4.0 / 2011-11-15196-==================197-198- * Added support for `--`. Closes #24199-200-0.3.3 / 2011-11-14201-==================202-203- * Fixed: wait for close event when writing help info [Jerry Hamlet]204-205-0.3.2 / 2011-11-01206-==================207-208- * Fixed long flag definitions with values [felixge]209-210-0.3.1 / 2011-10-31211-==================212-213- * Changed `--version` short flag to `-V` from `-v`214- * Changed `.version()` so it's configurable [felixge]215-216-0.3.0 / 2011-10-31217-==================218-219- * Added support for long flags only. Closes #18220-221-0.2.1 / 2011-10-24222-==================223-224- * "node": ">= 0.4.x < 0.7.0". Closes #20225-226-0.2.0 / 2011-09-26227-==================228-229- * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]230-231-0.1.0 / 2011-08-24232-==================233-234- * Added support for custom `--help` output235-236-0.0.5 / 2011-08-18237-==================238-239- * Changed: when the user enters nothing prompt for password again240- * Fixed issue with passwords beginning with numbers [NuckChorris]241-242-0.0.4 / 2011-08-15243-==================244-245- * Fixed `Commander#args`246-247-0.0.3 / 2011-08-15248-==================249-250- * Added default option value support251-252-0.0.2 / 2011-08-15253-==================254-255- * Added mask support to `Command#password(str[, mask], fn)`256- * Added `Command#password(str, fn)`257-258-0.0.1 / 2010-01-03259-==================260-261- * Initial releasemodified:index.js+260 added-162 removed
2 unmodified lines3 */4 5 var EventEmitter = require('events').EventEmitter;6 var spawn = require('child_process').spawn;7-var readlink = require('graceful-readlink').readlinkSync;7 var path = require('path');8 var dirname = path.dirname;9 var basename = path.basename;10 var fs = require('fs');11 12 /**13+ * Inherit `Command` from `EventEmitter.prototype`.14+ */15+16+require('util').inherits(Command, EventEmitter);17+18+/**19 * Expose the root command.20 */21 22 exports = module.exports = new Command();19 unmodified lines42 */43 44 function Option(flags, description) {45 this.flags = flags;41- this.required = ~flags.indexOf('<');42- this.optional = ~flags.indexOf('[');43- this.bool = !~flags.indexOf('-no-');46+ this.required = flags.indexOf('<') >= 0;47+ this.optional = flags.indexOf('[') >= 0;48+ this.bool = flags.indexOf('-no-') === -1;49 flags = flags.split(/[ ,|]+/);50 if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();51 this.long = flags.shift();52 this.description = description || '';12 unmodified lines65 .replace('no-', '');66 };67 68 /**69+ * Return option name, in a camelcase format that can be used70+ * as a object attribute key.71+ *72+ * @return {String}73+ * @api private74+ */75+76+Option.prototype.attributeName = function() {77+ return camelcase(this.name());78+};79+80+/**81 * Check if `arg` matches the short or long flag.82 *83 * @param {String} arg84 * @return {Boolean}85 * @api private86 */87 88 Option.prototype.is = function(arg) {72- return arg == this.short || arg == this.long;89+ return this.short === arg || this.long === arg;90 };91 92 /**93 * Initialize a new `Command`.11 unmodified lines105 this._name = name || '';106 }107 108 /**92- * Inherit from `EventEmitter.prototype`.93- */94-95-Command.prototype.__proto__ = EventEmitter.prototype;96-97-/**109 * Add command `name`.110 *111 * The `.action()` callback is invoked when the112 * command `name` is specified via __ARGV__,53 unmodified lines166 * @api public167 */168 169 Command.prototype.command = function(name, desc, opts) {170+ if (typeof desc === 'object' && desc !== null) {171+ opts = desc;172+ desc = null;173+ }174 opts = opts || {};175 var args = name.split(/ +/);176 var cmd = new Command(args.shift());177 2 unmodified lines180 this.executables = true;181 this._execs[cmd._name] = true;182 if (opts.isDefault) this.defaultExecutable = cmd._name;183 }169-184 cmd._noHelp = !!opts.noHelp;185 this.commands.push(cmd);186 cmd.parseExpectedArgs(args);187 cmd.parent = this;7 unmodified lines195 *196 * @api public197 */198 185-Command.prototype.arguments = function (desc) {199+Command.prototype.arguments = function(desc) {200 return this.parseExpectedArgs(desc.split(/ +/));201 };202 203 /**87 unmodified lines291 // Leftover arguments need to be pushed back. Fixes issue #56292 if (parsed.args.length) args = parsed.args.concat(args);293 294 self._args.forEach(function(arg, i) {281- if (arg.required && null == args[i]) {295+ if (arg.required && args[i] == null) {296 self.missingArgument(arg.name);297 } else if (arg.variadic) {298 if (i !== self._args.length - 1) {299 self.variadicArgNotLast(arg.name);15 unmodified lines315 fn.apply(self, args);316 };317 var parent = this.parent || this;318 var name = parent === this ? '*' : this._name;305- parent.on(name, listener);306- if (this._alias) parent.on(this._alias, listener);319+ parent.on('command:' + name, listener);320+ if (this._alias) parent.on('command:' + this._alias, listener);321 return this;322 };323 324 /**38 unmodified lines363 * program.option('-c, --cheese [type]', 'add cheese [marble]');364 *365 * @param {String} flags366 * @param {String} description353- * @param {Function|Mixed} fn or default354- * @param {Mixed} defaultValue367+ * @param {Function|*} [fn] or default368+ * @param {*} [defaultValue]369 * @return {Command} for chaining370 * @api public371 */372 373 Command.prototype.option = function(flags, description, fn, defaultValue) {360- var self = this361- , option = new Option(flags, description)362- , oname = option.name()363- , name = camelcase(oname);374+ var self = this,375+ option = new Option(flags, description),376+ oname = option.name(),377+ name = option.attributeName();378 379 // default as 3rd arg366- if (typeof fn != 'function') {380+ if (typeof fn !== 'function') {381 if (fn instanceof RegExp) {382 var regex = fn;383 fn = function(val, def) {384 var m = regex.exec(val);385 return m ? m[0] : def;372- }373- }374- else {386+ };387+ } else {388 defaultValue = fn;389 fn = null;390 }391 }392 393 // preassign default value only for --no-*, [optional], or <required>381- if (false == option.bool || option.optional || option.required) {394+ if (!option.bool || option.optional || option.required) {395 // when --no-* we make sure default is true383- if (false == option.bool) defaultValue = true;396+ if (!option.bool) defaultValue = true;397 // preassign only if we have a default385- if (undefined !== defaultValue) self[name] = defaultValue;398+ if (defaultValue !== undefined) {399+ self[name] = defaultValue;400+ option.defaultValue = defaultValue;401+ }402 }403 404 // register the option405 this.options.push(option);406 407 // when it's passed assign the value408 // and conditionally invoke the callback393- this.on(oname, function(val) {409+ this.on('option:' + oname, function(val) {410 // coercion395- if (null !== val && fn) val = fn(val, undefined === self[name]396- ? defaultValue397- : self[name]);411+ if (val !== null && fn) {412+ val = fn(val, self[name] === undefined ? defaultValue : self[name]);413+ }414 415 // unassigned or bool400- if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {416+ if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') {417 // if no value, bool true, and we have a default, then use it!402- if (null == val) {418+ if (val == null) {419 self[name] = option.bool420 ? defaultValue || true421 : false;422 } else {423 self[name] = val;424 }409- } else if (null !== val) {425+ } else if (val !== null) {426 // reassign427 self[name] = val;428 }429 });8 unmodified lines438 * for unknown options.439 * @api public440 */441 Command.prototype.allowUnknownOption = function(arg) {426- this._allowUnknownOption = arguments.length === 0 || arg;427- return this;442+ this._allowUnknownOption = arguments.length === 0 || arg;443+ return this;444 };445 446 /**447 * Parse `argv`, settings options and invoking commands when defined.35 unmodified lines483 return command.alias() === name;484 })[0];485 }486 471- if (this._execs[name] && typeof this._execs[name] != "function") {487+ if (this._execs[name] && typeof this._execs[name] !== 'function') {488 return this.executeSubCommand(argv, args, parsed.unknown);489 } else if (aliasCommand) {490 // is alias of a subCommand491 args[0] = aliasCommand._name;19 unmodified lines511 Command.prototype.executeSubCommand = function(argv, args, unknown) {512 args = args.concat(unknown);513 514 if (!args.length) this.help();499- if ('help' == args[0] && 1 == args.length) this.help();515+ if (args[0] === 'help' && args.length === 1) this.help();516 517 // <cmd> --help502- if ('help' == args[0]) {518+ if (args[0] === 'help') {519 args[0] = args[1];520 args[1] = '--help';521 }522 523 // executable524 var f = argv[1];525 // name of the subcommand, link `pm-install`510- var bin = basename(f, '.js') + '-' + args[0];526+ var bin = basename(f, path.extname(f)) + '-' + args[0];527 512-528 // In case of globally installed, get the base dir where executable529 // subcommand file should be located at515- var baseDir516- , link = readlink(f);530+ var baseDir;531 518- // when symbolink is relative path519- if (link !== f && link.charAt(0) !== '/') {520- link = path.join(dirname(f), link)521- }522- baseDir = dirname(link);532+ var resolvedLink = fs.realpathSync(f);533 534+ baseDir = dirname(resolvedLink);535+536 // prefer local `./<bin>` to bin in the $PATH537 var localBin = path.join(baseDir, bin);538 527- // whether bin file is a js script with explicit `.js` extension539+ // whether bin file is a js script with explicit `.js` or `.ts` extension540 var isExplicitJS = false;541 if (exists(localBin + '.js')) {542 bin = localBin + '.js';543 isExplicitJS = true;544+ } else if (exists(localBin + '.ts')) {545+ bin = localBin + '.ts';546+ isExplicitJS = true;547+ } else if (exists(localBin + '.mjs')) {548+ bin = localBin + '.mjs';549+ isExplicitJS = true;550 } else if (exists(localBin)) {551 bin = localBin;552 }553 5 unmodified lines559 args.unshift(bin);560 // add executable arguments to spawn561 args = (process.execArgv || []).concat(args);562 545- proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] });563+ proc = spawn(process.argv[0], args, { stdio: 'inherit', customFds: [0, 1, 2] });564 } else {565 proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] });566 }567 } else {568 args.unshift(bin);569 // add executable arguments to spawn570 args = (process.execArgv || []).concat(args);553- proc = spawn(process.execPath, args, { stdio: 'inherit'});571+ proc = spawn(process.execPath, args, { stdio: 'inherit' });572 }573 574+ var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];575+ signals.forEach(function(signal) {576+ process.on(signal, function() {577+ if (proc.killed === false && proc.exitCode === null) {578+ proc.kill(signal);579+ }580+ });581+ });582 proc.on('close', process.exit.bind(process));583 proc.on('error', function(err) {558- if (err.code == "ENOENT") {559- console.error('\n %s(1) does not exist, try --help\n', bin);560- } else if (err.code == "EACCES") {561- console.error('\n %s(1) not executable. try chmod or run with root\n', bin);584+ if (err.code === 'ENOENT') {585+ console.error('error: %s(1) does not exist, try --help', bin);586+ } else if (err.code === 'EACCES') {587+ console.error('error: %s(1) not executable. try chmod or run with root', bin);588 }589 process.exit(1);590 });591 11 unmodified lines603 * @api private604 */605 606 Command.prototype.normalize = function(args) {581- var ret = []582- , arg583- , lastOpt584- , index;607+ var ret = [],608+ arg,609+ lastOpt,610+ index;611 612 for (var i = 0, len = args.length; i < len; ++i) {613 arg = args[i];614 if (i > 0) {589- lastOpt = this.optionFor(args[i-1]);615+ lastOpt = this.optionFor(args[i - 1]);616 }617 618 if (arg === '--') {619 // Honor option terminator620 ret = ret.concat(args.slice(i));621 break;622 } else if (lastOpt && lastOpt.required) {623 ret.push(arg);598- } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {624+ } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') {625 arg.slice(1).split('').forEach(function(c) {626 ret.push('-' + c);627 });628 } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {22 unmodified lines651 var name;652 653 if (args.length) {654 name = args[0];629- if (this.listeners(name).length) {630- this.emit(args.shift(), args, unknown);655+ if (this.listeners('command:' + name).length) {656+ this.emit('command:' + args.shift(), args, unknown);657 } else {632- this.emit('*', args);658+ this.emit('command:*', args);659 }660 } else {661 outputHelpIfNecessary(this, unknown);662 1 unmodified line664 // then they are extraneous and we need to error.665 if (unknown.length > 0) {666 this.unknownOption(unknown[0]);667 }668+ if (this.commands.length === 0 &&669+ this._args.filter(function(a) { return a.required; }).length === 0) {670+ this.emit('command:*');671+ }672 }673 674 return this;675 };23 unmodified lines699 * @api public700 */701 702 Command.prototype.parseOptions = function(argv) {673- var args = []674- , len = argv.length675- , literal676- , option677- , arg;703+ var args = [],704+ len = argv.length,705+ literal,706+ option,707+ arg;708 709 var unknownOptions = [];710 711 // parse options5 unmodified lines717 args.push(arg);718 continue;719 }720 691- if ('--' == arg) {721+ if (arg === '--') {722 literal = true;723 continue;724 }725 4 unmodified lines730 if (option) {731 // requires arg732 if (option.required) {733 arg = argv[++i];704- if (null == arg) return this.optionMissingArgument(option);705- this.emit(option.name(), arg);734+ if (arg == null) return this.optionMissingArgument(option);735+ this.emit('option:' + option.name(), arg);736 // optional arg737 } else if (option.optional) {708- arg = argv[i+1];709- if (null == arg || ('-' == arg[0] && '-' != arg)) {738+ arg = argv[i + 1];739+ if (arg == null || (arg[0] === '-' && arg !== '-')) {740 arg = null;741 } else {742 ++i;743 }714- this.emit(option.name(), arg);744+ this.emit('option:' + option.name(), arg);745 // bool746 } else {717- this.emit(option.name());747+ this.emit('option:' + option.name());748 }749 continue;750 }751 752 // looks like an option723- if (arg.length > 1 && '-' == arg[0]) {753+ if (arg.length > 1 && arg[0] === '-') {754 unknownOptions.push(arg);755 756 // If the next argument looks like it might be757 // an argument for this option, we pass it on.758 // If it isn't, then it'll simply be ignored729- if (argv[i+1] && '-' != argv[i+1][0]) {759+ if ((i + 1) < argv.length && argv[i + 1][0] !== '-') {760 unknownOptions.push(argv[++i]);761 }762 continue;763 }11 unmodified lines775 * @return {Object}776 * @api public777 */778 Command.prototype.opts = function() {749- var result = {}750- , len = this.options.length;779+ var result = {},780+ len = this.options.length;781 752- for (var i = 0 ; i < len; i++) {753- var key = camelcase(this.options[i].name());754- result[key] = key === 'version' ? this._version : this[key];782+ for (var i = 0; i < len; i++) {783+ var key = this.options[i].attributeName();784+ result[key] = key === this._versionOptionName ? this._version : this[key];785 }786 return result;787 };788 4 unmodified lines793 * @api private794 */795 796 Command.prototype.missingArgument = function(name) {767- console.error();768- console.error(" error: missing required argument `%s'", name);797+ console.error("error: missing required argument `%s'", name);769- console.error();798 process.exit(1);799 };800 801 /**4 unmodified lines806 * @api private807 */808 809 Command.prototype.optionMissingArgument = function(option, flag) {782- console.error();810 if (flag) {784- console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);811+ console.error("error: option `%s' argument missing, got `%s'", option.flags, flag);812 } else {786- console.error(" error: option `%s' argument missing", option.flags);813+ console.error("error: option `%s' argument missing", option.flags);814 }788- console.error();815 process.exit(1);816 };817 818 /**4 unmodified lines823 */824 825 Command.prototype.unknownOption = function(flag) {826 if (this._allowUnknownOption) return;801- console.error();802- console.error(" error: unknown option `%s'", flag);827+ console.error("error: unknown option `%s'", flag);803- console.error();828 process.exit(1);829 };830 831 /**3 unmodified lines835 * @api private836 */837 838 Command.prototype.variadicArgNotLast = function(name) {815- console.error();816- console.error(" error: variadic arguments must be last `%s'", name);839+ console.error("error: variadic arguments must be last `%s'", name);817- console.error();840 process.exit(1);841 };842 843 /**2 unmodified lines846 * This method auto-registers the "-V, --version" flag847 * which will print the version number when passed.848 *849 * @param {String} str828- * @param {String} flags850+ * @param {String} [flags]851 * @return {Command} for chaining852 * @api public853 */854 855 Command.prototype.version = function(str, flags) {834- if (0 == arguments.length) return this._version;856+ if (arguments.length === 0) return this._version;857 this._version = str;858 flags = flags || '-V, --version';837- this.option(flags, 'output the version number');838- this.on('version', function() {859+ var versionOption = new Option(flags, 'output the version number');860+ this._versionOptionName = versionOption.long.substr(2) || 'version';861+ this.options.push(versionOption);862+ this.on('option:' + this._versionOptionName, function() {863 process.stdout.write(str + '\n');864 process.exit(0);865 });866 return this;2 unmodified lines869 /**870 * Set the description to `str`.871 *872 * @param {String} str873+ * @param {Object} argsDescription874 * @return {String|Command}875 * @api public876 */877 853-Command.prototype.description = function(str) {854- if (0 === arguments.length) return this._description;878+Command.prototype.description = function(str, argsDescription) {879+ if (arguments.length === 0) return this._description;880 this._description = str;881+ this._argsDescription = argsDescription;882 return this;883 };884 885 /**5 unmodified lines891 */892 893 Command.prototype.alias = function(alias) {894 var command = this;869- if(this.commands.length !== 0) {870- command = this.commands[this.commands.length - 1]895+ if (this.commands.length !== 0) {896+ command = this.commands[this.commands.length - 1];897 }898 899 if (arguments.length === 0) return command._alias;900 901+ if (alias === command._name) throw new Error('Command alias can\'t be the same as its name');902+903 command._alias = alias;904 return this;905 };906 9 unmodified lines916 var args = this._args.map(function(arg) {917 return humanReadableArgName(arg);918 });919 892- var usage = '[options]'893- + (this.commands.length ? ' [command]' : '')894- + (this._args.length ? ' ' + args.join(' ') : '');920+ var usage = '[options]' +921+ (this.commands.length ? ' [command]' : '') +922+ (this._args.length ? ' ' + args.join(' ') : '');923 896- if (0 == arguments.length) return this._usage || usage;924+ if (arguments.length === 0) return this._usage || usage;925 this._usage = str;926 927 return this;928 };929 930 /**903- * Get the name of the command931+ * Get or set the name of the command932 *905- * @param {String} name933+ * @param {String} str934 * @return {String|Command}935 * @api public936 */937 910-Command.prototype.name = function() {911- return this._name;938+Command.prototype.name = function(str) {939+ if (arguments.length === 0) return this._name;940+ this._name = str;941+ return this;942 };943 944 /**945+ * Return prepared commands.946+ *947+ * @return {Array}948+ * @api private949+ */950+951+Command.prototype.prepareCommands = function() {952+ return this.commands.filter(function(cmd) {953+ return !cmd._noHelp;954+ }).map(function(cmd) {955+ var args = cmd._args.map(function(arg) {956+ return humanReadableArgName(arg);957+ }).join(' ');958+959+ return [960+ cmd._name +961+ (cmd._alias ? '|' + cmd._alias : '') +962+ (cmd.options.length ? ' [options]' : '') +963+ (args ? ' ' + args : ''),964+ cmd._description965+ ];966+ });967+};968+969+/**970+ * Return the largest command length.971+ *972+ * @return {Number}973+ * @api private974+ */975+976+Command.prototype.largestCommandLength = function() {977+ var commands = this.prepareCommands();978+ return commands.reduce(function(max, command) {979+ return Math.max(max, command[0].length);980+ }, 0);981+};982+983+/**984 * Return the largest option length.985 *986 * @return {Number}987 * @api private988 */989 990 Command.prototype.largestOptionLength = function() {991+ var options = [].slice.call(this.options);992+ options.push({993+ flags: '-h, --help'994+ });922- return this.options.reduce(function(max, option) {995+ return options.reduce(function(max, option) {996 return Math.max(max, option.flags.length);997 }, 0);998 };999 1000 /**1001+ * Return the largest arg length.1002+ *1003+ * @return {Number}1004+ * @api private1005+ */1006+1007+Command.prototype.largestArgLength = function() {1008+ return this._args.reduce(function(max, arg) {1009+ return Math.max(max, arg.name.length);1010+ }, 0);1011+};1012+1013+/**1014+ * Return the pad width.1015+ *1016+ * @return {Number}1017+ * @api private1018+ */1019+1020+Command.prototype.padWidth = function() {1021+ var width = this.largestOptionLength();1022+ if (this._argsDescription && this._args.length) {1023+ if (this.largestArgLength() > width) {1024+ width = this.largestArgLength();1025+ }1026+ }1027+1028+ if (this.commands && this.commands.length) {1029+ if (this.largestCommandLength() > width) {1030+ width = this.largestCommandLength();1031+ }1032+ }1033+1034+ return width;1035+};1036+1037+/**1038 * Return help for options.1039 *1040 * @return {String}1041 * @api private1042 */1043 1044 Command.prototype.optionHelp = function() {935- var width = this.largestOptionLength();1045+ var width = this.padWidth();1046 937- // Prepend the help information938- return [pad('-h, --help', width) + ' ' + 'output usage information']939- .concat(this.options.map(function(option) {940- return pad(option.flags, width) + ' ' + option.description;941- }))942- .join('\n');1047+ // Append the help information1048+ return this.options.map(function(option) {1049+ return pad(option.flags, width) + ' ' + option.description +1050+ ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');1051+ }).concat([pad('-h, --help', width) + ' ' + 'output usage information'])1052+ .join('\n');1053 };1054 1055 /**1056 * Return command help documentation.4 unmodified lines1061 1062 Command.prototype.commandHelp = function() {1063 if (!this.commands.length) return '';1064 955- var commands = this.commands.filter(function(cmd) {956- return !cmd._noHelp;957- }).map(function(cmd) {958- var args = cmd._args.map(function(arg) {959- return humanReadableArgName(arg);960- }).join(' ');1065+ var commands = this.prepareCommands();1066+ var width = this.padWidth();1067 962- return [963- cmd._name964- + (cmd._alias ? '|' + cmd._alias : '')965- + (cmd.options.length ? ' [options]' : '')966- + ' ' + args967- , cmd._description968- ];969- });970-971- var width = commands.reduce(function(max, command) {972- return Math.max(max, command[0].length);973- }, 0);974-1068 return [976- ''977- , ' Commands:'978- , ''979- , commands.map(function(cmd) {1069+ 'Commands:',1070+ commands.map(function(cmd) {1071 var desc = cmd[1] ? ' ' + cmd[1] : '';981- return pad(cmd[0], width) + desc;982- }).join('\n').replace(/^/gm, ' ')983- , ''1072+ return (desc ? pad(cmd[0], width) : cmd[0]) + desc;1073+ }).join('\n').replace(/^/gm, ' '),1074+ ''1075 ].join('\n');1076 };1077 1078 /**6 unmodified lines1085 Command.prototype.helpInformation = function() {1086 var desc = [];1087 if (this._description) {1088 desc = [998- ' ' + this._description999- , ''1089+ this._description,1090+ ''1091 ];1092+1093+ var argsDescription = this._argsDescription;1094+ if (argsDescription && this._args.length) {1095+ var width = this.padWidth();1096+ desc.push('Arguments:');1097+ desc.push('');1098+ this._args.forEach(function(arg) {1099+ desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]);1100+ });1101+ desc.push('');1102+ }1103 }1104 1105 var cmdName = this._name;1106 if (this._alias) {1107 cmdName = cmdName + '|' + this._alias;1108 }1109 var usage = [1110+ 'Usage: ' + cmdName + ' ' + this.usage(),1111 ''1009- ,' Usage: ' + cmdName + ' ' + this.usage()1010- , ''1112 ];1113 1114 var cmds = [];1115 var commandHelp = this.commandHelp();1116 if (commandHelp) cmds = [commandHelp];1117 1118 var options = [1018- ' Options:'1019- , ''1020- , '' + this.optionHelp().replace(/^/gm, ' ')1021- , ''1022- , ''1119+ 'Options:',1120+ '' + this.optionHelp().replace(/^/gm, ' '),1121+ ''1122 ];1123 1124 return usage1026- .concat(cmds)1125 .concat(desc)1126 .concat(options)1127+ .concat(cmds)1128 .join('\n');1129 };1130 1131 /**5 unmodified lines1137 Command.prototype.outputHelp = function(cb) {1138 if (!cb) {1139 cb = function(passthru) {1140 return passthru;1042- }1141+ };1142 }1143 process.stdout.write(cb(this.helpInformation()));1144 this.emit('--help');1145 };47 unmodified lines1193 1194 function outputHelpIfNecessary(cmd, options) {1195 options = options || [];1196 for (var i = 0; i < options.length; i++) {1098- if (options[i] == '--help' || options[i] == '-h') {1197+ if (options[i] === '--help' || options[i] === '-h') {1198 cmd.outputHelp();1199 process.exit(0);1200 }1201 }11 unmodified lines1213 var nameOutput = arg.name + (arg.variadic === true ? '...' : '');1214 1215 return arg.required1216 ? '<' + nameOutput + '>'1118- : '[' + nameOutput + ']'1217+ : '[' + nameOutput + ']';1218 }1219 1220 // for versions before node v0.8 when there weren't `fs.existsSync`1221 function exists(file) {4 unmodified lines1226 } catch (e) {1227 return false;1228 }1229 }1131-deleted:Makefile-7 removed
1-2-TESTS = $(shell find test/test.*.js)3-4-test:5- @./test/run $(TESTS)6-7-.PHONY: testadded:package-lock.json+2170 added
1+{2+ "name": "commander",3+ "version": "2.20.0",4+ "lockfileVersion": 1,5+ "requires": true,6+ "dependencies": {7+ "@babel/code-frame": {8+ "version": "7.0.0",9+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",10+ "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",11+ "dev": true,12+ "requires": {13+ "@babel/highlight": "^7.0.0"14+ }15+ },16+ "@babel/highlight": {17+ "version": "7.0.0",18+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz",19+ "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==",20+ "dev": true,21+ "requires": {22+ "chalk": "^2.0.0",23+ "esutils": "^2.0.2",24+ "js-tokens": "^4.0.0"25+ },26+ "dependencies": {27+ "js-tokens": {28+ "version": "4.0.0",29+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",30+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",31+ "dev": true32+ }33+ }34+ },35+ "@sinonjs/commons": {36+ "version": "1.0.2",37+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.0.2.tgz",38+ "integrity": "sha512-WR3dlgqJP4QNrLC4iXN/5/2WaLQQ0VijOOkmflqFGVJ6wLEpbSjo7c0ZeGIdtY8Crk7xBBp87sM6+Mkerz7alw==",39+ "dev": true,40+ "requires": {41+ "type-detect": "4.0.8"42+ }43+ },44+ "@sinonjs/formatio": {45+ "version": "3.0.0",46+ "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.0.0.tgz",47+ "integrity": "sha512-vdjoYLDptCgvtJs57ULshak3iJe4NW3sJ3g36xVDGff5AE8P30S6A093EIEPjdi2noGhfuNOEkbxt3J3awFW1w==",48+ "dev": true,49+ "requires": {50+ "@sinonjs/samsam": "2.1.0"51+ },52+ "dependencies": {53+ "@sinonjs/samsam": {54+ "version": "2.1.0",55+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.0.tgz",56+ "integrity": "sha512-5x2kFgJYupaF1ns/RmharQ90lQkd2ELS8A9X0ymkAAdemYHGtI2KiUHG8nX2WU0T1qgnOU5YMqnBM2V7NUanNw==",57+ "dev": true,58+ "requires": {59+ "array-from": "^2.1.1"60+ }61+ }62+ }63+ },64+ "@sinonjs/samsam": {65+ "version": "2.1.1",66+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.1.tgz",67+ "integrity": "sha512-7oX6PXMulvdN37h88dvlvRyu61GYZau40fL4wEZvPEHvrjpJc3lDv6xDM5n4Z0StufUVB5nDvVZUM+jZHdMOOQ==",68+ "dev": true,69+ "requires": {70+ "array-from": "^2.1.1"71+ }72+ },73+ "@types/node": {74+ "version": "10.11.3",75+ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.3.tgz",76+ "integrity": "sha512-3AvcEJAh9EMatxs+OxAlvAEs7OTy6AG94mcH1iqyVDwVVndekLxzwkWQ/Z4SDbY6GO2oyUXyWW8tQ4rENSSQVQ==",77+ "dev": true78+ },79+ "acorn": {80+ "version": "5.7.1",81+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz",82+ "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==",83+ "dev": true84+ },85+ "acorn-jsx": {86+ "version": "4.1.1",87+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-4.1.1.tgz",88+ "integrity": "sha512-JY+iV6r+cO21KtntVvFkD+iqjtdpRUpGqKWgfkCdZq1R+kbreEl8EcdcJR4SmiIgsIQT33s6QzheQ9a275Q8xw==",89+ "dev": true,90+ "requires": {91+ "acorn": "^5.0.3"92+ }93+ },94+ "ajv": {95+ "version": "6.5.3",96+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz",97+ "integrity": "sha512-LqZ9wY+fx3UMiiPd741yB2pj3hhil+hQc8taf4o2QGRFpWgZ2V5C8HA165DY9sS3fJwsk7uT7ZlFEyC3Ig3lLg==",98+ "dev": true,99+ "requires": {100+ "fast-deep-equal": "^2.0.1",101+ "fast-json-stable-stringify": "^2.0.0",102+ "json-schema-traverse": "^0.4.1",103+ "uri-js": "^4.2.2"104+ }105+ },106+ "ajv-keywords": {107+ "version": "3.2.0",108+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz",109+ "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=",110+ "dev": true111+ },112+ "ansi-escapes": {113+ "version": "3.1.0",114+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",115+ "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==",116+ "dev": true117+ },118+ "ansi-regex": {119+ "version": "2.1.1",120+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",121+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",122+ "dev": true123+ },124+ "ansi-styles": {125+ "version": "2.2.1",126+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",127+ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",128+ "dev": true129+ },130+ "argparse": {131+ "version": "1.0.10",132+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",133+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",134+ "dev": true,135+ "requires": {136+ "sprintf-js": "~1.0.2"137+ }138+ },139+ "array-from": {140+ "version": "2.1.1",141+ "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz",142+ "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=",143+ "dev": true144+ },145+ "array-includes": {146+ "version": "3.0.3",147+ "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz",148+ "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=",149+ "dev": true,150+ "requires": {151+ "define-properties": "^1.1.2",152+ "es-abstract": "^1.7.0"153+ }154+ },155+ "array-union": {156+ "version": "1.0.2",157+ "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",158+ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",159+ "dev": true,160+ "requires": {161+ "array-uniq": "^1.0.1"162+ }163+ },164+ "array-uniq": {165+ "version": "1.0.3",166+ "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",167+ "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=",168+ "dev": true169+ },170+ "arrify": {171+ "version": "1.0.1",172+ "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",173+ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",174+ "dev": true175+ },176+ "babel-code-frame": {177+ "version": "6.26.0",178+ "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",179+ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",180+ "dev": true,181+ "requires": {182+ "chalk": "^1.1.3",183+ "esutils": "^2.0.2",184+ "js-tokens": "^3.0.2"185+ },186+ "dependencies": {187+ "chalk": {188+ "version": "1.1.3",189+ "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",190+ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",191+ "dev": true,192+ "requires": {193+ "ansi-styles": "^2.2.1",194+ "escape-string-regexp": "^1.0.2",195+ "has-ansi": "^2.0.0",196+ "strip-ansi": "^3.0.0",197+ "supports-color": "^2.0.0"198+ }199+ },200+ "strip-ansi": {201+ "version": "3.0.1",202+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",203+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",204+ "dev": true,205+ "requires": {206+ "ansi-regex": "^2.0.0"207+ }208+ }209+ }210+ },211+ "balanced-match": {212+ "version": "1.0.0",213+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",214+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",215+ "dev": true216+ },217+ "brace-expansion": {218+ "version": "1.1.11",219+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",220+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",221+ "dev": true,222+ "requires": {223+ "balanced-match": "^1.0.0",224+ "concat-map": "0.0.1"225+ }226+ },227+ "buffer-from": {228+ "version": "1.1.0",229+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz",230+ "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==",231+ "dev": true232+ },233+ "builtin-modules": {234+ "version": "1.1.1",235+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",236+ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",237+ "dev": true238+ },239+ "caller-path": {240+ "version": "0.1.0",241+ "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz",242+ "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=",243+ "dev": true,244+ "requires": {245+ "callsites": "^0.2.0"246+ }247+ },248+ "callsites": {249+ "version": "0.2.0",250+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz",251+ "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=",252+ "dev": true253+ },254+ "chalk": {255+ "version": "2.4.1",256+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",257+ "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",258+ "dev": true,259+ "requires": {260+ "ansi-styles": "^3.2.1",261+ "escape-string-regexp": "^1.0.5",262+ "supports-color": "^5.3.0"263+ },264+ "dependencies": {265+ "ansi-styles": {266+ "version": "3.2.1",267+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",268+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",269+ "dev": true,270+ "requires": {271+ "color-convert": "^1.9.0"272+ }273+ },274+ "supports-color": {275+ "version": "5.4.0",276+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",277+ "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",278+ "dev": true,279+ "requires": {280+ "has-flag": "^3.0.0"281+ }282+ }283+ }284+ },285+ "chardet": {286+ "version": "0.4.2",287+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz",288+ "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=",289+ "dev": true290+ },291+ "circular-json": {292+ "version": "0.3.3",293+ "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",294+ "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==",295+ "dev": true296+ },297+ "cli-cursor": {298+ "version": "2.1.0",299+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",300+ "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",301+ "dev": true,302+ "requires": {303+ "restore-cursor": "^2.0.0"304+ }305+ },306+ "cli-width": {307+ "version": "2.2.0",308+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",309+ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",310+ "dev": true311+ },312+ "color-convert": {313+ "version": "1.9.2",314+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz",315+ "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==",316+ "dev": true,317+ "requires": {318+ "color-name": "1.1.1"319+ }320+ },321+ "color-name": {322+ "version": "1.1.1",323+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz",324+ "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=",325+ "dev": true326+ },327+ "concat-map": {328+ "version": "0.0.1",329+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",330+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",331+ "dev": true332+ },333+ "contains-path": {334+ "version": "0.1.0",335+ "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz",336+ "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=",337+ "dev": true338+ },339+ "cross-spawn": {340+ "version": "6.0.5",341+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",342+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",343+ "dev": true,344+ "requires": {345+ "nice-try": "^1.0.4",346+ "path-key": "^2.0.1",347+ "semver": "^5.5.0",348+ "shebang-command": "^1.2.0",349+ "which": "^1.2.9"350+ }351+ },352+ "debug": {353+ "version": "3.1.0",354+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",355+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",356+ "dev": true,357+ "requires": {358+ "ms": "2.0.0"359+ }360+ },361+ "debug-log": {362+ "version": "1.0.1",363+ "resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz",364+ "integrity": "sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8=",365+ "dev": true366+ },367+ "deep-is": {368+ "version": "0.1.3",369+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",370+ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",371+ "dev": true372+ },373+ "define-properties": {374+ "version": "1.1.3",375+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",376+ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",377+ "dev": true,378+ "requires": {379+ "object-keys": "^1.0.12"380+ }381+ },382+ "deglob": {383+ "version": "2.1.1",384+ "resolved": "https://registry.npmjs.org/deglob/-/deglob-2.1.1.tgz",385+ "integrity": "sha512-2kjwuGGonL7gWE1XU4Fv79+vVzpoQCl0V+boMwWtOQJV2AGDabCwez++nB1Nli/8BabAfZQ/UuHPlp6AymKdWw==",386+ "dev": true,387+ "requires": {388+ "find-root": "^1.0.0",389+ "glob": "^7.0.5",390+ "ignore": "^3.0.9",391+ "pkg-config": "^1.1.0",392+ "run-parallel": "^1.1.2",393+ "uniq": "^1.0.1"394+ },395+ "dependencies": {396+ "ignore": {397+ "version": "3.3.10",398+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz",399+ "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",400+ "dev": true401+ }402+ }403+ },404+ "del": {405+ "version": "2.2.2",406+ "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz",407+ "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=",408+ "dev": true,409+ "requires": {410+ "globby": "^5.0.0",411+ "is-path-cwd": "^1.0.0",412+ "is-path-in-cwd": "^1.0.0",413+ "object-assign": "^4.0.1",414+ "pify": "^2.0.0",415+ "pinkie-promise": "^2.0.0",416+ "rimraf": "^2.2.8"417+ }418+ },419+ "diff": {420+ "version": "3.5.0",421+ "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",422+ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",423+ "dev": true424+ },425+ "doctrine": {426+ "version": "2.1.0",427+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",428+ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",429+ "dev": true,430+ "requires": {431+ "esutils": "^2.0.2"432+ }433+ },434+ "error-ex": {435+ "version": "1.3.2",436+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",437+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",438+ "dev": true,439+ "requires": {440+ "is-arrayish": "^0.2.1"441+ }442+ },443+ "es-abstract": {444+ "version": "1.12.0",445+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz",446+ "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==",447+ "dev": true,448+ "requires": {449+ "es-to-primitive": "^1.1.1",450+ "function-bind": "^1.1.1",451+ "has": "^1.0.1",452+ "is-callable": "^1.1.3",453+ "is-regex": "^1.0.4"454+ }455+ },456+ "es-to-primitive": {457+ "version": "1.1.1",458+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz",459+ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=",460+ "dev": true,461+ "requires": {462+ "is-callable": "^1.1.1",463+ "is-date-object": "^1.0.1",464+ "is-symbol": "^1.0.1"465+ }466+ },467+ "escape-string-regexp": {468+ "version": "1.0.5",469+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",470+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",471+ "dev": true472+ },473+ "eslint": {474+ "version": "5.6.1",475+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.6.1.tgz",476+ "integrity": "sha512-hgrDtGWz368b7Wqf+v1Z69O3ZebNR0+GA7PtDdbmuz4rInFVUV9uw7whjZEiWyLzCjVb5Rs5WRN1TAS6eo7AYA==",477+ "dev": true,478+ "requires": {479+ "@babel/code-frame": "^7.0.0",480+ "ajv": "^6.5.3",481+ "chalk": "^2.1.0",482+ "cross-spawn": "^6.0.5",483+ "debug": "^4.0.1",484+ "doctrine": "^2.1.0",485+ "eslint-scope": "^4.0.0",486+ "eslint-utils": "^1.3.1",487+ "eslint-visitor-keys": "^1.0.0",488+ "espree": "^4.0.0",489+ "esquery": "^1.0.1",490+ "esutils": "^2.0.2",491+ "file-entry-cache": "^2.0.0",492+ "functional-red-black-tree": "^1.0.1",493+ "glob": "^7.1.2",494+ "globals": "^11.7.0",495+ "ignore": "^4.0.6",496+ "imurmurhash": "^0.1.4",497+ "inquirer": "^6.1.0",498+ "is-resolvable": "^1.1.0",499+ "js-yaml": "^3.12.0",500+ "json-stable-stringify-without-jsonify": "^1.0.1",501+ "levn": "^0.3.0",502+ "lodash": "^4.17.5",503+ "minimatch": "^3.0.4",504+ "mkdirp": "^0.5.1",505+ "natural-compare": "^1.4.0",506+ "optionator": "^0.8.2",507+ "path-is-inside": "^1.0.2",508+ "pluralize": "^7.0.0",509+ "progress": "^2.0.0",510+ "regexpp": "^2.0.0",511+ "require-uncached": "^1.0.3",512+ "semver": "^5.5.1",513+ "strip-ansi": "^4.0.0",514+ "strip-json-comments": "^2.0.1",515+ "table": "^4.0.3",516+ "text-table": "^0.2.0"517+ },518+ "dependencies": {519+ "debug": {520+ "version": "4.0.1",521+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.0.1.tgz",522+ "integrity": "sha512-K23FHJ/Mt404FSlp6gSZCevIbTMLX0j3fmHhUEhQ3Wq0FMODW3+cUSoLdy1Gx4polAf4t/lphhmHH35BB8cLYw==",523+ "dev": true,524+ "requires": {525+ "ms": "^2.1.1"526+ }527+ },528+ "ms": {529+ "version": "2.1.1",530+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",531+ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",532+ "dev": true533+ },534+ "semver": {535+ "version": "5.5.1",536+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz",537+ "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==",538+ "dev": true539+ }540+ }541+ },542+ "eslint-config-standard": {543+ "version": "12.0.0",544+ "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz",545+ "integrity": "sha512-COUz8FnXhqFitYj4DTqHzidjIL/t4mumGZto5c7DrBpvWoie+Sn3P4sLEzUGeYhRElWuFEf8K1S1EfvD1vixCQ==",546+ "dev": true547+ },548+ "eslint-config-standard-jsx": {549+ "version": "6.0.2",550+ "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-6.0.2.tgz",551+ "integrity": "sha512-D+YWAoXw+2GIdbMBRAzWwr1ZtvnSf4n4yL0gKGg7ShUOGXkSOLerI17K4F6LdQMJPNMoWYqepzQD/fKY+tXNSg==",552+ "dev": true553+ },554+ "eslint-import-resolver-node": {555+ "version": "0.3.2",556+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz",557+ "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==",558+ "dev": true,559+ "requires": {560+ "debug": "^2.6.9",561+ "resolve": "^1.5.0"562+ },563+ "dependencies": {564+ "debug": {565+ "version": "2.6.9",566+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",567+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",568+ "dev": true,569+ "requires": {570+ "ms": "2.0.0"571+ }572+ }573+ }574+ },575+ "eslint-module-utils": {576+ "version": "2.2.0",577+ "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz",578+ "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=",579+ "dev": true,580+ "requires": {581+ "debug": "^2.6.8",582+ "pkg-dir": "^1.0.0"583+ },584+ "dependencies": {585+ "debug": {586+ "version": "2.6.9",587+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",588+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",589+ "dev": true,590+ "requires": {591+ "ms": "2.0.0"592+ }593+ }594+ }595+ },596+ "eslint-plugin-es": {597+ "version": "1.3.1",598+ "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-1.3.1.tgz",599+ "integrity": "sha512-9XcVyZiQRVeFjqHw8qHNDAZcQLqaHlOGGpeYqzYh8S4JYCWTCO3yzyen8yVmA5PratfzTRWDwCOFphtDEG+w/w==",600+ "dev": true,601+ "requires": {602+ "eslint-utils": "^1.3.0",603+ "regexpp": "^2.0.0"604+ }605+ },606+ "eslint-plugin-import": {607+ "version": "2.14.0",608+ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz",609+ "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==",610+ "dev": true,611+ "requires": {612+ "contains-path": "^0.1.0",613+ "debug": "^2.6.8",614+ "doctrine": "1.5.0",615+ "eslint-import-resolver-node": "^0.3.1",616+ "eslint-module-utils": "^2.2.0",617+ "has": "^1.0.1",618+ "lodash": "^4.17.4",619+ "minimatch": "^3.0.3",620+ "read-pkg-up": "^2.0.0",621+ "resolve": "^1.6.0"622+ },623+ "dependencies": {624+ "debug": {625+ "version": "2.6.9",626+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",627+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",628+ "dev": true,629+ "requires": {630+ "ms": "2.0.0"631+ }632+ },633+ "doctrine": {634+ "version": "1.5.0",635+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz",636+ "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=",637+ "dev": true,638+ "requires": {639+ "esutils": "^2.0.2",640+ "isarray": "^1.0.0"641+ }642+ },643+ "isarray": {644+ "version": "1.0.0",645+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",646+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",647+ "dev": true648+ }649+ }650+ },651+ "eslint-plugin-node": {652+ "version": "7.0.1",653+ "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-7.0.1.tgz",654+ "integrity": "sha512-lfVw3TEqThwq0j2Ba/Ckn2ABdwmL5dkOgAux1rvOk6CO7A6yGyPI2+zIxN6FyNkp1X1X/BSvKOceD6mBWSj4Yw==",655+ "dev": true,656+ "requires": {657+ "eslint-plugin-es": "^1.3.1",658+ "eslint-utils": "^1.3.1",659+ "ignore": "^4.0.2",660+ "minimatch": "^3.0.4",661+ "resolve": "^1.8.1",662+ "semver": "^5.5.0"663+ }664+ },665+ "eslint-plugin-promise": {666+ "version": "4.0.1",667+ "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.0.1.tgz",668+ "integrity": "sha512-Si16O0+Hqz1gDHsys6RtFRrW7cCTB6P7p3OJmKp3Y3dxpQE2qwOA7d3xnV+0mBmrPoi0RBnxlCKvqu70te6wjg==",669+ "dev": true670+ },671+ "eslint-plugin-react": {672+ "version": "7.11.1",673+ "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz",674+ "integrity": "sha512-cVVyMadRyW7qsIUh3FHp3u6QHNhOgVrLQYdQEB1bPWBsgbNCHdFAeNMquBMCcZJu59eNthX053L70l7gRt4SCw==",675+ "dev": true,676+ "requires": {677+ "array-includes": "^3.0.3",678+ "doctrine": "^2.1.0",679+ "has": "^1.0.3",680+ "jsx-ast-utils": "^2.0.1",681+ "prop-types": "^15.6.2"682+ }683+ },684+ "eslint-plugin-standard": {685+ "version": "4.0.0",686+ "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.0.tgz",687+ "integrity": "sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA==",688+ "dev": true689+ },690+ "eslint-scope": {691+ "version": "4.0.0",692+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz",693+ "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==",694+ "dev": true,695+ "requires": {696+ "esrecurse": "^4.1.0",697+ "estraverse": "^4.1.1"698+ }699+ },700+ "eslint-utils": {701+ "version": "1.3.1",702+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz",703+ "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==",704+ "dev": true705+ },706+ "eslint-visitor-keys": {707+ "version": "1.0.0",708+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",709+ "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==",710+ "dev": true711+ },712+ "espree": {713+ "version": "4.0.0",714+ "resolved": "https://registry.npmjs.org/espree/-/espree-4.0.0.tgz",715+ "integrity": "sha512-kapdTCt1bjmspxStVKX6huolXVV5ZfyZguY1lcfhVVZstce3bqxH9mcLzNn3/mlgW6wQ732+0fuG9v7h0ZQoKg==",716+ "dev": true,717+ "requires": {718+ "acorn": "^5.6.0",719+ "acorn-jsx": "^4.1.1"720+ }721+ },722+ "esprima": {723+ "version": "4.0.0",724+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",725+ "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",726+ "dev": true727+ },728+ "esquery": {729+ "version": "1.0.1",730+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz",731+ "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==",732+ "dev": true,733+ "requires": {734+ "estraverse": "^4.0.0"735+ }736+ },737+ "esrecurse": {738+ "version": "4.2.1",739+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz",740+ "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==",741+ "dev": true,742+ "requires": {743+ "estraverse": "^4.1.0"744+ }745+ },746+ "estraverse": {747+ "version": "4.2.0",748+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",749+ "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=",750+ "dev": true751+ },752+ "esutils": {753+ "version": "2.0.2",754+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",755+ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",756+ "dev": true757+ },758+ "external-editor": {759+ "version": "2.2.0",760+ "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",761+ "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==",762+ "dev": true,763+ "requires": {764+ "chardet": "^0.4.0",765+ "iconv-lite": "^0.4.17",766+ "tmp": "^0.0.33"767+ }768+ },769+ "fast-deep-equal": {770+ "version": "2.0.1",771+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",772+ "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",773+ "dev": true774+ },775+ "fast-json-stable-stringify": {776+ "version": "2.0.0",777+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",778+ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",779+ "dev": true780+ },781+ "fast-levenshtein": {782+ "version": "2.0.6",783+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",784+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",785+ "dev": true786+ },787+ "figures": {788+ "version": "2.0.0",789+ "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",790+ "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",791+ "dev": true,792+ "requires": {793+ "escape-string-regexp": "^1.0.5"794+ }795+ },796+ "file-entry-cache": {797+ "version": "2.0.0",798+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",799+ "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=",800+ "dev": true,801+ "requires": {802+ "flat-cache": "^1.2.1",803+ "object-assign": "^4.0.1"804+ }805+ },806+ "find-root": {807+ "version": "1.1.0",808+ "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",809+ "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==",810+ "dev": true811+ },812+ "find-up": {813+ "version": "1.1.2",814+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",815+ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",816+ "dev": true,817+ "requires": {818+ "path-exists": "^2.0.0",819+ "pinkie-promise": "^2.0.0"820+ }821+ },822+ "flat-cache": {823+ "version": "1.3.0",824+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz",825+ "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=",826+ "dev": true,827+ "requires": {828+ "circular-json": "^0.3.1",829+ "del": "^2.0.2",830+ "graceful-fs": "^4.1.2",831+ "write": "^0.2.1"832+ }833+ },834+ "fs.realpath": {835+ "version": "1.0.0",836+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",837+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",838+ "dev": true839+ },840+ "function-bind": {841+ "version": "1.1.1",842+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",843+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",844+ "dev": true845+ },846+ "functional-red-black-tree": {847+ "version": "1.0.1",848+ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",849+ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",850+ "dev": true851+ },852+ "get-stdin": {853+ "version": "6.0.0",854+ "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz",855+ "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==",856+ "dev": true857+ },858+ "glob": {859+ "version": "7.1.2",860+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",861+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",862+ "dev": true,863+ "requires": {864+ "fs.realpath": "^1.0.0",865+ "inflight": "^1.0.4",866+ "inherits": "2",867+ "minimatch": "^3.0.4",868+ "once": "^1.3.0",869+ "path-is-absolute": "^1.0.0"870+ }871+ },872+ "globals": {873+ "version": "11.7.0",874+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz",875+ "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==",876+ "dev": true877+ },878+ "globby": {879+ "version": "5.0.0",880+ "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz",881+ "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=",882+ "dev": true,883+ "requires": {884+ "array-union": "^1.0.1",885+ "arrify": "^1.0.0",886+ "glob": "^7.0.3",887+ "object-assign": "^4.0.1",888+ "pify": "^2.0.0",889+ "pinkie-promise": "^2.0.0"890+ }891+ },892+ "graceful-fs": {893+ "version": "4.1.11",894+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",895+ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",896+ "dev": true897+ },898+ "has": {899+ "version": "1.0.3",900+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",901+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",902+ "dev": true,903+ "requires": {904+ "function-bind": "^1.1.1"905+ }906+ },907+ "has-ansi": {908+ "version": "2.0.0",909+ "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",910+ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",911+ "dev": true,912+ "requires": {913+ "ansi-regex": "^2.0.0"914+ }915+ },916+ "has-flag": {917+ "version": "3.0.0",918+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",919+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",920+ "dev": true921+ },922+ "hosted-git-info": {923+ "version": "2.7.1",924+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz",925+ "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",926+ "dev": true927+ },928+ "iconv-lite": {929+ "version": "0.4.24",930+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",931+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",932+ "dev": true,933+ "requires": {934+ "safer-buffer": ">= 2.1.2 < 3"935+ }936+ },937+ "ignore": {938+ "version": "4.0.6",939+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",940+ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",941+ "dev": true942+ },943+ "imurmurhash": {944+ "version": "0.1.4",945+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",946+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",947+ "dev": true948+ },949+ "inflight": {950+ "version": "1.0.6",951+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",952+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",953+ "dev": true,954+ "requires": {955+ "once": "^1.3.0",956+ "wrappy": "1"957+ }958+ },959+ "inherits": {960+ "version": "2.0.3",961+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",962+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",963+ "dev": true964+ },965+ "inquirer": {966+ "version": "6.2.0",967+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz",968+ "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==",969+ "dev": true,970+ "requires": {971+ "ansi-escapes": "^3.0.0",972+ "chalk": "^2.0.0",973+ "cli-cursor": "^2.1.0",974+ "cli-width": "^2.0.0",975+ "external-editor": "^3.0.0",976+ "figures": "^2.0.0",977+ "lodash": "^4.17.10",978+ "mute-stream": "0.0.7",979+ "run-async": "^2.2.0",980+ "rxjs": "^6.1.0",981+ "string-width": "^2.1.0",982+ "strip-ansi": "^4.0.0",983+ "through": "^2.3.6"984+ },985+ "dependencies": {986+ "chardet": {987+ "version": "0.7.0",988+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",989+ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",990+ "dev": true991+ },992+ "external-editor": {993+ "version": "3.0.3",994+ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz",995+ "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==",996+ "dev": true,997+ "requires": {998+ "chardet": "^0.7.0",999+ "iconv-lite": "^0.4.24",1000+ "tmp": "^0.0.33"1001+ }1002+ }1003+ }1004+ },1005+ "is-arrayish": {1006+ "version": "0.2.1",1007+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",1008+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",1009+ "dev": true1010+ },1011+ "is-builtin-module": {1012+ "version": "1.0.0",1013+ "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",1014+ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",1015+ "dev": true,1016+ "requires": {1017+ "builtin-modules": "^1.0.0"1018+ }1019+ },1020+ "is-callable": {1021+ "version": "1.1.4",1022+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",1023+ "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",1024+ "dev": true1025+ },1026+ "is-date-object": {1027+ "version": "1.0.1",1028+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",1029+ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",1030+ "dev": true1031+ },1032+ "is-fullwidth-code-point": {1033+ "version": "2.0.0",1034+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",1035+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",1036+ "dev": true1037+ },1038+ "is-path-cwd": {1039+ "version": "1.0.0",1040+ "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",1041+ "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=",1042+ "dev": true1043+ },1044+ "is-path-in-cwd": {1045+ "version": "1.0.1",1046+ "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz",1047+ "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==",1048+ "dev": true,1049+ "requires": {1050+ "is-path-inside": "^1.0.0"1051+ }1052+ },1053+ "is-path-inside": {1054+ "version": "1.0.1",1055+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz",1056+ "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=",1057+ "dev": true,1058+ "requires": {1059+ "path-is-inside": "^1.0.1"1060+ }1061+ },1062+ "is-promise": {1063+ "version": "2.1.0",1064+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",1065+ "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",1066+ "dev": true1067+ },1068+ "is-regex": {1069+ "version": "1.0.4",1070+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",1071+ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",1072+ "dev": true,1073+ "requires": {1074+ "has": "^1.0.1"1075+ }1076+ },1077+ "is-resolvable": {1078+ "version": "1.1.0",1079+ "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz",1080+ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==",1081+ "dev": true1082+ },1083+ "is-symbol": {1084+ "version": "1.0.1",1085+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz",1086+ "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=",1087+ "dev": true1088+ },1089+ "isarray": {1090+ "version": "0.0.1",1091+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",1092+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",1093+ "dev": true1094+ },1095+ "isexe": {1096+ "version": "2.0.0",1097+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",1098+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",1099+ "dev": true1100+ },1101+ "js-tokens": {1102+ "version": "3.0.2",1103+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",1104+ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",1105+ "dev": true1106+ },1107+ "js-yaml": {1108+ "version": "3.12.0",1109+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",1110+ "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",1111+ "dev": true,1112+ "requires": {1113+ "argparse": "^1.0.7",1114+ "esprima": "^4.0.0"1115+ }1116+ },1117+ "json-parse-better-errors": {1118+ "version": "1.0.2",1119+ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",1120+ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",1121+ "dev": true1122+ },1123+ "json-schema-traverse": {1124+ "version": "0.4.1",1125+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",1126+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",1127+ "dev": true1128+ },1129+ "json-stable-stringify-without-jsonify": {1130+ "version": "1.0.1",1131+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",1132+ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",1133+ "dev": true1134+ },1135+ "jsx-ast-utils": {1136+ "version": "2.0.1",1137+ "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz",1138+ "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=",1139+ "dev": true,1140+ "requires": {1141+ "array-includes": "^3.0.3"1142+ }1143+ },1144+ "just-extend": {1145+ "version": "3.0.0",1146+ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-3.0.0.tgz",1147+ "integrity": "sha512-Fu3T6pKBuxjWT/p4DkqGHFRsysc8OauWr4ZRTY9dIx07Y9O0RkoR5jcv28aeD1vuAwhm3nLkDurwLXoALp4DpQ==",1148+ "dev": true1149+ },1150+ "levn": {1151+ "version": "0.3.0",1152+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",1153+ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",1154+ "dev": true,1155+ "requires": {1156+ "prelude-ls": "~1.1.2",1157+ "type-check": "~0.3.2"1158+ }1159+ },1160+ "load-json-file": {1161+ "version": "2.0.0",1162+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",1163+ "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",1164+ "dev": true,1165+ "requires": {1166+ "graceful-fs": "^4.1.2",1167+ "parse-json": "^2.2.0",1168+ "pify": "^2.0.0",1169+ "strip-bom": "^3.0.0"1170+ }1171+ },1172+ "locate-path": {1173+ "version": "2.0.0",1174+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",1175+ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",1176+ "dev": true,1177+ "requires": {1178+ "p-locate": "^2.0.0",1179+ "path-exists": "^3.0.0"1180+ },1181+ "dependencies": {1182+ "path-exists": {1183+ "version": "3.0.0",1184+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",1185+ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",1186+ "dev": true1187+ }1188+ }1189+ },1190+ "lodash": {1191+ "version": "4.17.10",1192+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",1193+ "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==",1194+ "dev": true1195+ },1196+ "lodash.get": {1197+ "version": "4.4.2",1198+ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",1199+ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=",1200+ "dev": true1201+ },1202+ "lolex": {1203+ "version": "2.7.5",1204+ "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz",1205+ "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==",1206+ "dev": true1207+ },1208+ "loose-envify": {1209+ "version": "1.4.0",1210+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",1211+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",1212+ "dev": true,1213+ "requires": {1214+ "js-tokens": "^3.0.0 || ^4.0.0"1215+ }1216+ },1217+ "make-error": {1218+ "version": "1.3.4",1219+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz",1220+ "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==",1221+ "dev": true1222+ },1223+ "mimic-fn": {1224+ "version": "1.2.0",1225+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",1226+ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",1227+ "dev": true1228+ },1229+ "minimatch": {1230+ "version": "3.0.4",1231+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",1232+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",1233+ "dev": true,1234+ "requires": {1235+ "brace-expansion": "^1.1.7"1236+ }1237+ },1238+ "minimist": {1239+ "version": "0.0.8",1240+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",1241+ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",1242+ "dev": true1243+ },1244+ "mkdirp": {1245+ "version": "0.5.1",1246+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",1247+ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",1248+ "dev": true,1249+ "requires": {1250+ "minimist": "0.0.8"1251+ }1252+ },1253+ "ms": {1254+ "version": "2.0.0",1255+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",1256+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",1257+ "dev": true1258+ },1259+ "mute-stream": {1260+ "version": "0.0.7",1261+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",1262+ "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",1263+ "dev": true1264+ },1265+ "natural-compare": {1266+ "version": "1.4.0",1267+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",1268+ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",1269+ "dev": true1270+ },1271+ "nice-try": {1272+ "version": "1.0.5",1273+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",1274+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",1275+ "dev": true1276+ },1277+ "nise": {1278+ "version": "1.4.5",1279+ "resolved": "https://registry.npmjs.org/nise/-/nise-1.4.5.tgz",1280+ "integrity": "sha512-OHRVvdxKgwZELf2DTgsJEIA4MOq8XWvpSUzoOXyxJ2mY0mMENWC66+70AShLR2z05B1dzrzWlUQJmJERlOUpZw==",1281+ "dev": true,1282+ "requires": {1283+ "@sinonjs/formatio": "3.0.0",1284+ "just-extend": "^3.0.0",1285+ "lolex": "^2.3.2",1286+ "path-to-regexp": "^1.7.0",1287+ "text-encoding": "^0.6.4"1288+ }1289+ },1290+ "normalize-package-data": {1291+ "version": "2.4.0",1292+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",1293+ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",1294+ "dev": true,1295+ "requires": {1296+ "hosted-git-info": "^2.1.4",1297+ "is-builtin-module": "^1.0.0",1298+ "semver": "2 || 3 || 4 || 5",1299+ "validate-npm-package-license": "^3.0.1"1300+ }1301+ },1302+ "object-assign": {1303+ "version": "4.1.1",1304+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",1305+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",1306+ "dev": true1307+ },1308+ "object-keys": {1309+ "version": "1.0.12",1310+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz",1311+ "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==",1312+ "dev": true1313+ },1314+ "once": {1315+ "version": "1.4.0",1316+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",1317+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",1318+ "dev": true,1319+ "requires": {1320+ "wrappy": "1"1321+ }1322+ },1323+ "onetime": {1324+ "version": "2.0.1",1325+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",1326+ "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",1327+ "dev": true,1328+ "requires": {1329+ "mimic-fn": "^1.0.0"1330+ }1331+ },1332+ "optionator": {1333+ "version": "0.8.2",1334+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",1335+ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=",1336+ "dev": true,1337+ "requires": {1338+ "deep-is": "~0.1.3",1339+ "fast-levenshtein": "~2.0.4",1340+ "levn": "~0.3.0",1341+ "prelude-ls": "~1.1.2",1342+ "type-check": "~0.3.2",1343+ "wordwrap": "~1.0.0"1344+ }1345+ },1346+ "os-tmpdir": {1347+ "version": "1.0.2",1348+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",1349+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",1350+ "dev": true1351+ },1352+ "p-limit": {1353+ "version": "1.3.0",1354+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",1355+ "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",1356+ "dev": true,1357+ "requires": {1358+ "p-try": "^1.0.0"1359+ }1360+ },1361+ "p-locate": {1362+ "version": "2.0.0",1363+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",1364+ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",1365+ "dev": true,1366+ "requires": {1367+ "p-limit": "^1.1.0"1368+ }1369+ },1370+ "p-try": {1371+ "version": "1.0.0",1372+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",1373+ "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",1374+ "dev": true1375+ },1376+ "parse-json": {1377+ "version": "2.2.0",1378+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",1379+ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",1380+ "dev": true,1381+ "requires": {1382+ "error-ex": "^1.2.0"1383+ }1384+ },1385+ "path-exists": {1386+ "version": "2.1.0",1387+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",1388+ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",1389+ "dev": true,1390+ "requires": {1391+ "pinkie-promise": "^2.0.0"1392+ }1393+ },1394+ "path-is-absolute": {1395+ "version": "1.0.1",1396+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",1397+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",1398+ "dev": true1399+ },1400+ "path-is-inside": {1401+ "version": "1.0.2",1402+ "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",1403+ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",1404+ "dev": true1405+ },1406+ "path-key": {1407+ "version": "2.0.1",1408+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",1409+ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",1410+ "dev": true1411+ },1412+ "path-parse": {1413+ "version": "1.0.6",1414+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",1415+ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",1416+ "dev": true1417+ },1418+ "path-to-regexp": {1419+ "version": "1.7.0",1420+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz",1421+ "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=",1422+ "dev": true,1423+ "requires": {1424+ "isarray": "0.0.1"1425+ }1426+ },1427+ "path-type": {1428+ "version": "2.0.0",1429+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",1430+ "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",1431+ "dev": true,1432+ "requires": {1433+ "pify": "^2.0.0"1434+ }1435+ },1436+ "pify": {1437+ "version": "2.3.0",1438+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",1439+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",1440+ "dev": true1441+ },1442+ "pinkie": {1443+ "version": "2.0.4",1444+ "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",1445+ "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",1446+ "dev": true1447+ },1448+ "pinkie-promise": {1449+ "version": "2.0.1",1450+ "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",1451+ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",1452+ "dev": true,1453+ "requires": {1454+ "pinkie": "^2.0.0"1455+ }1456+ },1457+ "pkg-conf": {1458+ "version": "2.1.0",1459+ "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz",1460+ "integrity": "sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=",1461+ "dev": true,1462+ "requires": {1463+ "find-up": "^2.0.0",1464+ "load-json-file": "^4.0.0"1465+ },1466+ "dependencies": {1467+ "find-up": {1468+ "version": "2.1.0",1469+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",1470+ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",1471+ "dev": true,1472+ "requires": {1473+ "locate-path": "^2.0.0"1474+ }1475+ },1476+ "load-json-file": {1477+ "version": "4.0.0",1478+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",1479+ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=",1480+ "dev": true,1481+ "requires": {1482+ "graceful-fs": "^4.1.2",1483+ "parse-json": "^4.0.0",1484+ "pify": "^3.0.0",1485+ "strip-bom": "^3.0.0"1486+ }1487+ },1488+ "parse-json": {1489+ "version": "4.0.0",1490+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",1491+ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",1492+ "dev": true,1493+ "requires": {1494+ "error-ex": "^1.3.1",1495+ "json-parse-better-errors": "^1.0.1"1496+ }1497+ },1498+ "pify": {1499+ "version": "3.0.0",1500+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",1501+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",1502+ "dev": true1503+ }1504+ }1505+ },1506+ "pkg-config": {1507+ "version": "1.1.1",1508+ "resolved": "https://registry.npmjs.org/pkg-config/-/pkg-config-1.1.1.tgz",1509+ "integrity": "sha1-VX7yLXPaPIg3EHdmxS6tq94pj+Q=",1510+ "dev": true,1511+ "requires": {1512+ "debug-log": "^1.0.0",1513+ "find-root": "^1.0.0",1514+ "xtend": "^4.0.1"1515+ }1516+ },1517+ "pkg-dir": {1518+ "version": "1.0.0",1519+ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz",1520+ "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=",1521+ "dev": true,1522+ "requires": {1523+ "find-up": "^1.0.0"1524+ }1525+ },1526+ "pluralize": {1527+ "version": "7.0.0",1528+ "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz",1529+ "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==",1530+ "dev": true1531+ },1532+ "prelude-ls": {1533+ "version": "1.1.2",1534+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",1535+ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",1536+ "dev": true1537+ },1538+ "progress": {1539+ "version": "2.0.0",1540+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz",1541+ "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=",1542+ "dev": true1543+ },1544+ "prop-types": {1545+ "version": "15.6.2",1546+ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz",1547+ "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==",1548+ "dev": true,1549+ "requires": {1550+ "loose-envify": "^1.3.1",1551+ "object-assign": "^4.1.1"1552+ }1553+ },1554+ "punycode": {1555+ "version": "2.1.1",1556+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",1557+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",1558+ "dev": true1559+ },1560+ "read-pkg": {1561+ "version": "2.0.0",1562+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",1563+ "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",1564+ "dev": true,1565+ "requires": {1566+ "load-json-file": "^2.0.0",1567+ "normalize-package-data": "^2.3.2",1568+ "path-type": "^2.0.0"1569+ }1570+ },1571+ "read-pkg-up": {1572+ "version": "2.0.0",1573+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",1574+ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",1575+ "dev": true,1576+ "requires": {1577+ "find-up": "^2.0.0",1578+ "read-pkg": "^2.0.0"1579+ },1580+ "dependencies": {1581+ "find-up": {1582+ "version": "2.1.0",1583+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",1584+ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",1585+ "dev": true,1586+ "requires": {1587+ "locate-path": "^2.0.0"1588+ }1589+ }1590+ }1591+ },1592+ "regexpp": {1593+ "version": "2.0.0",1594+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.0.tgz",1595+ "integrity": "sha512-g2FAVtR8Uh8GO1Nv5wpxW7VFVwHcCEr4wyA8/MHiRkO8uHoR5ntAA8Uq3P1vvMTX/BeQiRVSpDGLd+Wn5HNOTA==",1596+ "dev": true1597+ },1598+ "require-uncached": {1599+ "version": "1.0.3",1600+ "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",1601+ "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=",1602+ "dev": true,1603+ "requires": {1604+ "caller-path": "^0.1.0",1605+ "resolve-from": "^1.0.0"1606+ }1607+ },1608+ "resolve": {1609+ "version": "1.8.1",1610+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz",1611+ "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==",1612+ "dev": true,1613+ "requires": {1614+ "path-parse": "^1.0.5"1615+ }1616+ },1617+ "resolve-from": {1618+ "version": "1.0.1",1619+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz",1620+ "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=",1621+ "dev": true1622+ },1623+ "restore-cursor": {1624+ "version": "2.0.0",1625+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",1626+ "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",1627+ "dev": true,1628+ "requires": {1629+ "onetime": "^2.0.0",1630+ "signal-exit": "^3.0.2"1631+ }1632+ },1633+ "rimraf": {1634+ "version": "2.6.2",1635+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",1636+ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",1637+ "dev": true,1638+ "requires": {1639+ "glob": "^7.0.5"1640+ }1641+ },1642+ "run-async": {1643+ "version": "2.3.0",1644+ "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",1645+ "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=",1646+ "dev": true,1647+ "requires": {1648+ "is-promise": "^2.1.0"1649+ }1650+ },1651+ "run-parallel": {1652+ "version": "1.1.9",1653+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz",1654+ "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==",1655+ "dev": true1656+ },1657+ "rxjs": {1658+ "version": "6.3.3",1659+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz",1660+ "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==",1661+ "dev": true,1662+ "requires": {1663+ "tslib": "^1.9.0"1664+ }1665+ },1666+ "safer-buffer": {1667+ "version": "2.1.2",1668+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",1669+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",1670+ "dev": true1671+ },1672+ "semver": {1673+ "version": "5.5.0",1674+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",1675+ "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",1676+ "dev": true1677+ },1678+ "shebang-command": {1679+ "version": "1.2.0",1680+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",1681+ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",1682+ "dev": true,1683+ "requires": {1684+ "shebang-regex": "^1.0.0"1685+ }1686+ },1687+ "shebang-regex": {1688+ "version": "1.0.0",1689+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",1690+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",1691+ "dev": true1692+ },1693+ "should": {1694+ "version": "13.2.3",1695+ "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz",1696+ "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==",1697+ "dev": true,1698+ "requires": {1699+ "should-equal": "^2.0.0",1700+ "should-format": "^3.0.3",1701+ "should-type": "^1.4.0",1702+ "should-type-adaptors": "^1.0.1",1703+ "should-util": "^1.0.0"1704+ }1705+ },1706+ "should-equal": {1707+ "version": "2.0.0",1708+ "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz",1709+ "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==",1710+ "dev": true,1711+ "requires": {1712+ "should-type": "^1.4.0"1713+ }1714+ },1715+ "should-format": {1716+ "version": "3.0.3",1717+ "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz",1718+ "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=",1719+ "dev": true,1720+ "requires": {1721+ "should-type": "^1.3.0",1722+ "should-type-adaptors": "^1.0.1"1723+ }1724+ },1725+ "should-type": {1726+ "version": "1.4.0",1727+ "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz",1728+ "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=",1729+ "dev": true1730+ },1731+ "should-type-adaptors": {1732+ "version": "1.1.0",1733+ "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz",1734+ "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==",1735+ "dev": true,1736+ "requires": {1737+ "should-type": "^1.3.0",1738+ "should-util": "^1.0.0"1739+ }1740+ },1741+ "should-util": {1742+ "version": "1.0.0",1743+ "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz",1744+ "integrity": "sha1-yYzaN0qmsZDfi6h8mInCtNtiAGM=",1745+ "dev": true1746+ },1747+ "signal-exit": {1748+ "version": "3.0.2",1749+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",1750+ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",1751+ "dev": true1752+ },1753+ "sinon": {1754+ "version": "6.3.4",1755+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-6.3.4.tgz",1756+ "integrity": "sha512-NIaR56Z1mefuRBXYrf4otqBxkWiKveX+fvqs3HzFq2b07HcgpkMgIwmQM/owNjNFAHkx0kJXW+Q0mDthiuslXw==",1757+ "dev": true,1758+ "requires": {1759+ "@sinonjs/commons": "^1.0.2",1760+ "@sinonjs/formatio": "^3.0.0",1761+ "@sinonjs/samsam": "^2.1.1",1762+ "diff": "^3.5.0",1763+ "lodash.get": "^4.4.2",1764+ "lolex": "^2.7.4",1765+ "nise": "^1.4.5",1766+ "supports-color": "^5.5.0",1767+ "type-detect": "^4.0.8"1768+ },1769+ "dependencies": {1770+ "supports-color": {1771+ "version": "5.5.0",1772+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",1773+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",1774+ "dev": true,1775+ "requires": {1776+ "has-flag": "^3.0.0"1777+ }1778+ }1779+ }1780+ },1781+ "slice-ansi": {1782+ "version": "1.0.0",1783+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz",1784+ "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==",1785+ "dev": true,1786+ "requires": {1787+ "is-fullwidth-code-point": "^2.0.0"1788+ }1789+ },1790+ "source-map": {1791+ "version": "0.6.1",1792+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",1793+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",1794+ "dev": true1795+ },1796+ "source-map-support": {1797+ "version": "0.5.8",1798+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.8.tgz",1799+ "integrity": "sha512-WqAEWPdb78u25RfKzOF0swBpY0dKrNdjc4GvLwm7ScX/o9bj8Eh/YL8mcMhBHYDGl87UkkSXDOFnW4G7GhWhGg==",1800+ "dev": true,1801+ "requires": {1802+ "buffer-from": "^1.0.0",1803+ "source-map": "^0.6.0"1804+ }1805+ },1806+ "spdx-correct": {1807+ "version": "3.0.0",1808+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz",1809+ "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==",1810+ "dev": true,1811+ "requires": {1812+ "spdx-expression-parse": "^3.0.0",1813+ "spdx-license-ids": "^3.0.0"1814+ }1815+ },1816+ "spdx-exceptions": {1817+ "version": "2.1.0",1818+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz",1819+ "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==",1820+ "dev": true1821+ },1822+ "spdx-expression-parse": {1823+ "version": "3.0.0",1824+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",1825+ "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",1826+ "dev": true,1827+ "requires": {1828+ "spdx-exceptions": "^2.1.0",1829+ "spdx-license-ids": "^3.0.0"1830+ }1831+ },1832+ "spdx-license-ids": {1833+ "version": "3.0.0",1834+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz",1835+ "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==",1836+ "dev": true1837+ },1838+ "sprintf-js": {1839+ "version": "1.0.3",1840+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",1841+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",1842+ "dev": true1843+ },1844+ "standard": {1845+ "version": "12.0.1",1846+ "resolved": "https://registry.npmjs.org/standard/-/standard-12.0.1.tgz",1847+ "integrity": "sha512-UqdHjh87OG2gUrNCSM4QRLF5n9h3TFPwrCNyVlkqu31Hej0L/rc8hzKqVvkb2W3x0WMq7PzZdkLfEcBhVOR6lg==",1848+ "dev": true,1849+ "requires": {1850+ "eslint": "~5.4.0",1851+ "eslint-config-standard": "12.0.0",1852+ "eslint-config-standard-jsx": "6.0.2",1853+ "eslint-plugin-import": "~2.14.0",1854+ "eslint-plugin-node": "~7.0.1",1855+ "eslint-plugin-promise": "~4.0.0",1856+ "eslint-plugin-react": "~7.11.1",1857+ "eslint-plugin-standard": "~4.0.0",1858+ "standard-engine": "~9.0.0"1859+ },1860+ "dependencies": {1861+ "eslint": {1862+ "version": "5.4.0",1863+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz",1864+ "integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==",1865+ "dev": true,1866+ "requires": {1867+ "ajv": "^6.5.0",1868+ "babel-code-frame": "^6.26.0",1869+ "chalk": "^2.1.0",1870+ "cross-spawn": "^6.0.5",1871+ "debug": "^3.1.0",1872+ "doctrine": "^2.1.0",1873+ "eslint-scope": "^4.0.0",1874+ "eslint-utils": "^1.3.1",1875+ "eslint-visitor-keys": "^1.0.0",1876+ "espree": "^4.0.0",1877+ "esquery": "^1.0.1",1878+ "esutils": "^2.0.2",1879+ "file-entry-cache": "^2.0.0",1880+ "functional-red-black-tree": "^1.0.1",1881+ "glob": "^7.1.2",1882+ "globals": "^11.7.0",1883+ "ignore": "^4.0.2",1884+ "imurmurhash": "^0.1.4",1885+ "inquirer": "^5.2.0",1886+ "is-resolvable": "^1.1.0",1887+ "js-yaml": "^3.11.0",1888+ "json-stable-stringify-without-jsonify": "^1.0.1",1889+ "levn": "^0.3.0",1890+ "lodash": "^4.17.5",1891+ "minimatch": "^3.0.4",1892+ "mkdirp": "^0.5.1",1893+ "natural-compare": "^1.4.0",1894+ "optionator": "^0.8.2",1895+ "path-is-inside": "^1.0.2",1896+ "pluralize": "^7.0.0",1897+ "progress": "^2.0.0",1898+ "regexpp": "^2.0.0",1899+ "require-uncached": "^1.0.3",1900+ "semver": "^5.5.0",1901+ "strip-ansi": "^4.0.0",1902+ "strip-json-comments": "^2.0.1",1903+ "table": "^4.0.3",1904+ "text-table": "^0.2.0"1905+ }1906+ },1907+ "inquirer": {1908+ "version": "5.2.0",1909+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz",1910+ "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==",1911+ "dev": true,1912+ "requires": {1913+ "ansi-escapes": "^3.0.0",1914+ "chalk": "^2.0.0",1915+ "cli-cursor": "^2.1.0",1916+ "cli-width": "^2.0.0",1917+ "external-editor": "^2.1.0",1918+ "figures": "^2.0.0",1919+ "lodash": "^4.3.0",1920+ "mute-stream": "0.0.7",1921+ "run-async": "^2.2.0",1922+ "rxjs": "^5.5.2",1923+ "string-width": "^2.1.0",1924+ "strip-ansi": "^4.0.0",1925+ "through": "^2.3.6"1926+ }1927+ },1928+ "rxjs": {1929+ "version": "5.5.12",1930+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.12.tgz",1931+ "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==",1932+ "dev": true,1933+ "requires": {1934+ "symbol-observable": "1.0.1"1935+ }1936+ }1937+ }1938+ },1939+ "standard-engine": {1940+ "version": "9.0.0",1941+ "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-9.0.0.tgz",1942+ "integrity": "sha512-ZfNfCWZ2Xq67VNvKMPiVMKHnMdvxYzvZkf1AH8/cw2NLDBm5LRsxMqvEJpsjLI/dUosZ3Z1d6JlHDp5rAvvk2w==",1943+ "dev": true,1944+ "requires": {1945+ "deglob": "^2.1.0",1946+ "get-stdin": "^6.0.0",1947+ "minimist": "^1.1.0",1948+ "pkg-conf": "^2.0.0"1949+ },1950+ "dependencies": {1951+ "minimist": {1952+ "version": "1.2.0",1953+ "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",1954+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",1955+ "dev": true1956+ }1957+ }1958+ },1959+ "string-width": {1960+ "version": "2.1.1",1961+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",1962+ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",1963+ "dev": true,1964+ "requires": {1965+ "is-fullwidth-code-point": "^2.0.0",1966+ "strip-ansi": "^4.0.0"1967+ }1968+ },1969+ "strip-ansi": {1970+ "version": "4.0.0",1971+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",1972+ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",1973+ "dev": true,1974+ "requires": {1975+ "ansi-regex": "^3.0.0"1976+ },1977+ "dependencies": {1978+ "ansi-regex": {1979+ "version": "3.0.0",1980+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",1981+ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",1982+ "dev": true1983+ }1984+ }1985+ },1986+ "strip-bom": {1987+ "version": "3.0.0",1988+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",1989+ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",1990+ "dev": true1991+ },1992+ "strip-json-comments": {1993+ "version": "2.0.1",1994+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",1995+ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",1996+ "dev": true1997+ },1998+ "supports-color": {1999+ "version": "2.0.0",2000+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",2001+ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",2002+ "dev": true2003+ },2004+ "symbol-observable": {2005+ "version": "1.0.1",2006+ "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz",2007+ "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=",2008+ "dev": true2009+ },2010+ "table": {2011+ "version": "4.0.3",2012+ "resolved": "https://registry.npmjs.org/table/-/table-4.0.3.tgz",2013+ "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==",2014+ "dev": true,2015+ "requires": {2016+ "ajv": "^6.0.1",2017+ "ajv-keywords": "^3.0.0",2018+ "chalk": "^2.1.0",2019+ "lodash": "^4.17.4",2020+ "slice-ansi": "1.0.0",2021+ "string-width": "^2.1.1"2022+ }2023+ },2024+ "text-encoding": {2025+ "version": "0.6.4",2026+ "resolved": "http://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz",2027+ "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=",2028+ "dev": true2029+ },2030+ "text-table": {2031+ "version": "0.2.0",2032+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",2033+ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",2034+ "dev": true2035+ },2036+ "through": {2037+ "version": "2.3.8",2038+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",2039+ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",2040+ "dev": true2041+ },2042+ "tmp": {2043+ "version": "0.0.33",2044+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",2045+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",2046+ "dev": true,2047+ "requires": {2048+ "os-tmpdir": "~1.0.2"2049+ }2050+ },2051+ "ts-node": {2052+ "version": "7.0.1",2053+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz",2054+ "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==",2055+ "dev": true,2056+ "requires": {2057+ "arrify": "^1.0.0",2058+ "buffer-from": "^1.1.0",2059+ "diff": "^3.1.0",2060+ "make-error": "^1.1.1",2061+ "minimist": "^1.2.0",2062+ "mkdirp": "^0.5.1",2063+ "source-map-support": "^0.5.6",2064+ "yn": "^2.0.0"2065+ },2066+ "dependencies": {2067+ "minimist": {2068+ "version": "1.2.0",2069+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",2070+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",2071+ "dev": true2072+ }2073+ }2074+ },2075+ "tslib": {2076+ "version": "1.9.3",2077+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",2078+ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==",2079+ "dev": true2080+ },2081+ "type-check": {2082+ "version": "0.3.2",2083+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",2084+ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",2085+ "dev": true,2086+ "requires": {2087+ "prelude-ls": "~1.1.2"2088+ }2089+ },2090+ "type-detect": {2091+ "version": "4.0.8",2092+ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",2093+ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",2094+ "dev": true2095+ },2096+ "typescript": {2097+ "version": "2.9.2",2098+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",2099+ "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",2100+ "dev": true2101+ },2102+ "uniq": {2103+ "version": "1.0.1",2104+ "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz",2105+ "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=",2106+ "dev": true2107+ },2108+ "uri-js": {2109+ "version": "4.2.2",2110+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",2111+ "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",2112+ "dev": true,2113+ "requires": {2114+ "punycode": "^2.1.0"2115+ }2116+ },2117+ "validate-npm-package-license": {2118+ "version": "3.0.4",2119+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",2120+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",2121+ "dev": true,2122+ "requires": {2123+ "spdx-correct": "^3.0.0",2124+ "spdx-expression-parse": "^3.0.0"2125+ }2126+ },2127+ "which": {2128+ "version": "1.3.1",2129+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",2130+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",2131+ "dev": true,2132+ "requires": {2133+ "isexe": "^2.0.0"2134+ }2135+ },2136+ "wordwrap": {2137+ "version": "1.0.0",2138+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",2139+ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",2140+ "dev": true2141+ },2142+ "wrappy": {2143+ "version": "1.0.2",2144+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",2145+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",2146+ "dev": true2147+ },2148+ "write": {2149+ "version": "0.2.1",2150+ "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz",2151+ "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=",2152+ "dev": true,2153+ "requires": {2154+ "mkdirp": "^0.5.1"2155+ }2156+ },2157+ "xtend": {2158+ "version": "4.0.1",2159+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",2160+ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",2161+ "dev": true2162+ },2163+ "yn": {2164+ "version": "2.0.0",2165+ "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",2166+ "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=",2167+ "dev": true2168+ }2169+ }2170+}modified:package.json+17 added-13 removed
1 {2 "name": "commander",3- "version": "2.9.0",3+ "version": "2.20.0",4 "description": "the complete solution for node.js command-line programs",5 "keywords": [6 "commander",7 "command",5 unmodified lines13 "repository": {14 "type": "git",15 "url": "https://github.com/tj/commander.js.git"16 },17- "devDependencies": {18- "should": ">= 0.0.1 <9.0.0",19- "sinon": ">=1.17.1"20- },17 "scripts": {22- "test": "make test"18+ "lint": "eslint index.js",19+ "test": "node test/run.js && npm run test-typings",20+ "test-typings": "tsc -p tsconfig.json"21 },22 "main": "index",25- "engines": {26- "node": ">= 0.6.x"27- },23 "files": [29- "index.js"24+ "index.js",25+ "typings/index.d.ts"26 ],31- "dependencies": {32- "graceful-readlink": ">= 1.0.0"33- }27+ "dependencies": {},28+ "devDependencies": {29+ "@types/node": "^10.11.3",30+ "eslint": "^5.6.1",31+ "should": "^13.2.3",32+ "sinon": "^6.3.4",33+ "standard": "^12.0.1",34+ "ts-node": "^7.0.1",35+ "typescript": "^2.9.2"36+ },37+ "typings": "typings/index.d.ts"38 }modified:Readme_zh-CN.md+33 added-44 removed
2 unmodified lines3 4 [](http://travis-ci.org/tj/commander.js)5 [](https://www.npmjs.org/package/commander)6 [](https://www.npmjs.org/package/commander)7-[](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)7 9- [node.js](http://nodejs.org) 命令行接口的完整解决方案,灵感来自 Ruby 的 [commander](https://github.com/tj/commander)。 8+ [node.js](http://nodejs.org) 命令行接口的完整解决方案,灵感来自 Ruby 的 [commander](https://github.com/commander-rb/commander)。 9 [API 文档](http://tj.github.com/commander.js/)10 11 12 ## 安装13 14 $ npm install commander15 16 ## 参数解析18- 定义并使用 commander 的选项功能 `.option()` 方法。作为这些选项的文档,下面的例子会解析来自 `progress.argv` 指定的参数和选项,留下剩余未被选择的参数放到 `program.args` 数组中。17+ `.option()` 方法用来定义带选项的 commander,同时也作为这些选项的文档。下面的例子会解析来自 `process.argv` 指定的参数和选项,没有匹配任何选项的参数将会放到 `program.args` 数组中。18 19 ```js20 #!/usr/bin/env node21 70 unmodified lines92 .version('0.0.1')93 .option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')94 .option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)95 .parse(process.argv);97- 96+97 console.log(' size: %j', program.size);98 console.log(' drink: %j', program.drink);99 ```100 101 ## 可变参数102 104- 一个命令的最后一个参数可以是可变参数, 并且只能是最后一个参数。为了使参数可变,你需要在参数名后面追加 `...`。 下面是个示例:103+ 一个命令的最后一个参数可以是可变参数, 并且只有最后一个参数可变。为了使参数可变,你需要在参数名后面追加 `...`。 下面是个示例:104 105 ```js106 #!/usr/bin/env node107 16 unmodified lines124 });125 126 program.parse(process.argv);127 ```128+可变参数的值以 `数组` 的形式保存。如上所示,在传递给你的 action 的参数和 `program.args` 中的值都是如此。129 130- `数组` 是可以用于给可变参数传值的。 这适用于 `program.args` 以及参数传递,以你的行动证明上述。131- 你可以如上所示的去尝试。132-130 ## 指定参数的语法131 132 ```js133 #!/usr/bin/env node16 unmodified lines150 }151 console.log('command:', cmdValue);152 console.log('environment:', envValue || "no environment given");153 ```154+尖括号(例如 `<cmd>`)代表必填输入,方括号(例如 `[env]`)代表可选输入。155 156 ## Git 风格的子命令157 158 ```js7 unmodified lines166 .command('list', 'list packages installed', {isDefault: true})167 .parse(process.argv);168 ```169 172- 当说明参数调用 `.command()` 时,没有 `.action(callback)` 应调用来处理子命令,否则会出错。这告诉 commander,你要使用单独的可执行文件的子命令,就像 `git(1)` 和其他流行工具一样。 173- Commander 将尝试在入口脚本的目录中搜索可执行文件,(像 `./examples/pm`)与名称 `program-command`,像 `pm-install`,`pm-search`。170+当 `.command()` 带有描述参数时,不能采用 `.action(callback)` 来处理子命令,否则会出错。这告诉 commander,你将采用单独的可执行文件作为子命令,就像 `git(1)` 和其他流行的工具一样。171+Commander 将会尝试在入口脚本(例如 `./examples/pm`)的目录中搜索 `program-command` 形式的可执行文件,例如 `pm-install`, `pm-search`。172 175- 对 `.command()` 的调用,可以传递选项。指定 `opts.noHelp` 为 `true` 将从生成的帮助输出中删除选项。如果没有其他子命令指定,指定 `opts.isDefault` 为 `true` 将运行子命令。173+你可以在调用 `.command()` 时传递选项。指定 `opts.noHelp` 为 `true` 将从生成的帮助输出中剔除该选项。指定 `opts.isDefault` 为 `true` 将会在没有其它子命令指定的情况下,执行该子命令。174 177- 如果打算全局(--global)安装该命令,请确保可执行文件有适当的模式,如 '755'。175+如果你打算全局安装该命令,请确保可执行文件有对应的权限,例如 `755`。176 177 ### `--harmony`178 181-您可以启用 `--harmoney` 选项在两个方面:182-* 用 `#!/usr/bin/env node --harmony` 在子命令脚本中。注意一些系统版本不支持此模式。183-* 用 `--harmoney` 选项时调用的命令,像 `node --harmony examples/pm publish`。`--harmoney` 选项当产生一个子命令进程时保留选项。179+您可以采用两种方式启用 `--harmony`:180+* 在子命令脚本中加上 `#!/usr/bin/env node --harmony`。注意一些系统版本不支持此模式。181+* 在指令调用时加上 `--harmony` 参数,例如 `node --harmony examples/pm publish`。`--harmony` 选项在开启子进程时会被保留。182 183 ## 自动化帮助信息 --help184 185 帮助信息是 commander 基于你的程序自动生成的,下面是 `--help` 生成的帮助信息:186 187 ``` 190- $ ./examples/pizza --help188+$ ./examples/pizza --help189+Usage: pizza [options]190 192- Usage: pizza [options]191+An application for pizzas ordering192 194- An application for pizzas ordering195-196- Options:197-198- -h, --help output usage information199- -V, --version output the version number200- -p, --peppers Add peppers201- -P, --pineapple Add pineapple202- -b, --bbq Add bbq sauce203- -c, --cheese <type> Add the specified type of cheese [marble]204- -C, --no-cheese You do not want any cheese193+Options:194+ -h, --help output usage information195+ -V, --version output the version number196+ -p, --peppers Add peppers197+ -P, --pineapple Add pineapple198+ -b, --bbq Add bbq sauce199+ -c, --cheese <type> Add the specified type of cheese [marble]200+ -C, --no-cheese You do not want any cheese205-201 ```202 203 ## 自定义帮助204 210- 你可以显示任何 `-h, --help` 信息,通过监听 `--help` 。一旦你完成了 Commander 将自动退出,你的程序的其余部分不会展示。例如在下面的 “stuff” 将不会在执行 `--help` 时输出。205+ 你可以通过监听 `--help` 来控制 `-h, --help` 显示任何信息。一旦调用完成, Commander 将自动退出,你的程序的其余部分不会展示。例如在下面的 “stuff” 将不会在执行 `--help` 时输出。206 207 ```js208 #!/usr/bin/env node209 12 unmodified lines222 // must be before .parse() since223 // node's emit() is immediate224 225 program.on('--help', function(){231- console.log(' Examples:');226 console.log('');233- console.log(' $ custom-help --help');234- console.log(' $ custom-help -h');235- console.log('');227+ console.log('Examples:');228+ console.log(' $ custom-help --help');229+ console.log(' $ custom-help -h');230 });231 232 program.parse(process.argv);233 2 unmodified lines236 237 下列帮助信息是运行 `node script-name.js -h` or `node script-name.js --help` 时输出的:238 239 ```246-240 Usage: custom-help [options]241 242 Options:250-243 -h, --help output usage information244 -V, --version output the version number245 -f, --foo enable some foo246 -b, --bar enable some bar247 -B, --baz enable some baz248 249 Examples:258-250 $ custom-help --help251 $ custom-help -h261-252 ```253 254 ## .outputHelp(cb)255 52 unmodified lines308 .option("-e, --exec_mode <mode>", "Which exec mode to use")309 .action(function(cmd, options){310 console.log('exec "%s" using %s mode', cmd, options.exec_mode);311 }).on('--help', function() {322- console.log(' Examples:');323- console.log();324- console.log(' $ deploy exec sequential');325- console.log(' $ deploy exec async');326- console.log();312+ console.log('');313+ console.log('Examples:');314+ console.log('');315+ console.log(' $ deploy exec sequential');316+ console.log(' $ deploy exec async');317 });318 319 program320 .command('*')8 unmodified lines329 330 ## 许可证331 332 MIT343-modified:Readme.md+128 added-53 removed
1 unmodified line2 3 4 [](http://travis-ci.org/tj/commander.js)5 [](https://www.npmjs.org/package/commander)6-[](https://www.npmjs.org/package/commander)7-[](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)6+[](https://npmcharts.com/compare/commander?minimal=true)7+[](https://packagephobia.now.sh/result?p=commander)8 9- The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/tj/commander). 9+ The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander). 10 [API documentation](http://tj.github.com/commander.js/)11 12 13 ## Installation14 15- $ npm install commander --save15+ $ npm install commander16 17 ## Option parsing18 19- 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.19+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.20 21 ```js22 #!/usr/bin/env node23 3 unmodified lines27 28 var program = require('commander');29 30 program31- .version('0.0.1')31+ .version('0.1.0')32 .option('-p, --peppers', 'Add peppers')33 .option('-P, --pineapple', 'Add pineapple')34 .option('-b, --bbq-sauce', 'Add bbq sauce')35 .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')5 unmodified lines41 if (program.bbqSauce) console.log(' - bbq');42 console.log(' - %s cheese', program.cheese);43 ```44 45- 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.45+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.46 47+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.48 49+```js50+#!/usr/bin/env node51+52+/**53+ * Module dependencies.54+ */55+56+var program = require('commander');57+58+program59+ .option('--no-sauce', 'Remove sauce')60+ .parse(process.argv);61+62+console.log('you ordered a pizza');63+if (program.sauce) console.log(' with sauce');64+else console.log(' without sauce');65+```66+67+To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs. 68+69+e.g. ```.option('-m --myarg [myVar]', 'my super cool description')```70+71+Then to access the input if it was passed in.72+73+e.g. ```var myInput = program.myarg```74+75+**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in.76+77+78+## Version option79+80+Calling the `version` implicitly adds the `-V` and `--version` options to the command.81+When either of these options is present, the command prints the version number and exits.82+83+ $ ./examples/pizza -V84+ 0.0.185+86+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.87+88+```js89+program90+ .version('0.0.1', '-v, --version')91+```92+93+The version flags can be named anything, but the long option is required.94+95+## Command-specific options96+97+You can attach options to a command.98+99+```js100+#!/usr/bin/env node101+102+var program = require('commander');103+104+program105+ .command('rm <dir>')106+ .option('-r, --recursive', 'Remove recursively')107+ .action(function (dir, cmd) {108+ console.log('remove ' + dir + (cmd.recursive ? ' recursively' : ''))109+ })110+111+program.parse(process.argv)112+```113+114+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.115+116 ## Coercion117 118 ```js119 function range(val) {13 unmodified lines133 return total + 1;134 }135 136 program69- .version('0.0.1')137+ .version('0.1.0')138 .usage('[options] <file ...>')139 .option('-i, --integer <n>', 'An integer argument', parseInt)140 .option('-f, --float <n>', 'A float argument', parseFloat)141 .option('-r, --range <a>..<b>', 'A range', range)16 unmodified lines158 159 ## Regular Expression160 ```js161 program94- .version('0.0.1')162+ .version('0.1.0')163 .option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')164 .option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)165 .parse(process.argv);98- 166+167 console.log(' size: %j', program.size);168 console.log(' drink: %j', program.drink);169 ```170 11 unmodified lines182 183 var program = require('commander');184 185 program118- .version('0.0.1')186+ .version('0.1.0')187 .command('rmdir <dir> [otherDirs...]')188 .action(function (dir, otherDirs) {189 console.log('rmdir %s', dir);190 if (otherDirs) {13 unmodified lines204 205 ```js206 #!/usr/bin/env node207 140-var program = require('../');208+var program = require('commander');209 210 program143- .version('0.0.1')211+ .version('0.1.0')212 .arguments('<cmd> [env]')213 .action(function (cmd, env) {214 cmdValue = cmd;215 envValue = env;13 unmodified lines229 ## Git-style sub-commands230 231 ```js232 // file: ./examples/pm165-var program = require('..');233+var program = require('commander');234 235 program168- .version('0.0.1')236+ .version('0.1.0')237 .command('install [name]', 'install one or more packages')238 .command('search [query]', 'search with optional query')239 .command('list', 'list packages installed', {isDefault: true})240 .parse(process.argv);1 unmodified line242 243 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. 244 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`.245 178-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.246+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.247 248 If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.249 250 ### `--harmony`6 unmodified lines257 258 The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:259 260 ``` 193- $ ./examples/pizza --help261+$ ./examples/pizza --help262+Usage: pizza [options]263 195- Usage: pizza [options]264+An application for pizzas ordering265 197- An application for pizzas ordering198-199- Options:200-201- -h, --help output usage information202- -V, --version output the version number203- -p, --peppers Add peppers204- -P, --pineapple Add pineapple205- -b, --bbq Add bbq sauce206- -c, --cheese <type> Add the specified type of cheese [marble]207- -C, --no-cheese You do not want any cheese266+Options:267+ -h, --help output usage information268+ -V, --version output the version number269+ -p, --peppers Add peppers270+ -P, --pineapple Add pineapple271+ -b, --bbq Add bbq sauce272+ -c, --cheese <type> Add the specified type of cheese [marble]273+ -C, --no-cheese You do not want any cheese208-274 ```275 276 ## Custom help277 278 You can display arbitrary `-h, --help` information279 by listening for "--help". Commander will automatically280 exit once you are done so that the remainder of your program216- does not execute causing undesired behaviours, for example281+ does not execute causing undesired behaviors, for example282 in the following executable "stuff" will not output when283 `--help` is used.284 285 ```js5 unmodified lines291 292 var program = require('commander');293 294 program230- .version('0.0.1')295+ .version('0.1.0')296 .option('-f, --foo', 'enable some foo')297 .option('-b, --bar', 'enable some bar')298 .option('-B, --baz', 'enable some baz');299 300 // must be before .parse() since301 // node's emit() is immediate302 303 program.on('--help', function(){239- console.log(' Examples:');240- console.log('');241- console.log(' $ custom-help --help');242- console.log(' $ custom-help -h');243- console.log('');304+ console.log('')305+ console.log('Examples:');306+ console.log(' $ custom-help --help');307+ console.log(' $ custom-help -h');308 });309 310 program.parse(process.argv);311 2 unmodified lines314 315 Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:316 317 ```254-318 Usage: custom-help [options]319 320 Options:258-321 -h, --help output usage information322 -V, --version output the version number323 -f, --foo enable some foo324 -b, --bar enable some bar325 -B, --baz enable some baz326 327 Examples:266-328 $ custom-help --help329 $ custom-help -h269-330 ```331 332 ## .outputHelp(cb)333 6 unmodified lines340 var program = require('commander');341 var colors = require('colors');342 343 program284- .version('0.0.1')344+ .version('0.1.0')345 .command('getstream [url]', 'get stream URL')346 .parse(process.argv);347 288- if (!process.argv.slice(2).length) {289- program.outputHelp(make_red);290- }348+if (!process.argv.slice(2).length) {349+ program.outputHelp(make_red);350+}351 352 function make_red(txt) {353 return colors.red(txt); //display the help text in red on the console354 }3 unmodified lines358 359 Output help information and exit immediately.360 Optional callback cb allows post-processing of help text before it is displayed.361 362+363+## Custom event listeners364+ You can execute custom actions by listening to command and option events.365+366+```js367+program.on('option:verbose', function () {368+ process.env.VERBOSE = this.verbose;369+});370+371+// error on unknown commands372+program.on('command:*', function () {373+ console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));374+ process.exit(1);375+});376+```377+378 ## Examples379 380 ```js381 var program = require('commander');382 383 program308- .version('0.0.1')384+ .version('0.1.0')385 .option('-C, --chdir <path>', 'change the working directory')386 .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')387 .option('-T, --no-tests', 'ignore test hook');388 14 unmodified lines403 .option("-e, --exec_mode <mode>", "Which exec mode to use")404 .action(function(cmd, options){405 console.log('exec "%s" using %s mode', cmd, options.exec_mode);406 }).on('--help', function() {331- console.log(' Examples:');332- console.log();333- console.log(' $ deploy exec sequential');334- console.log(' $ deploy exec async');335- console.log();407+ console.log('');408+ console.log('Examples:');409+ console.log('');410+ console.log(' $ deploy exec sequential');411+ console.log(' $ deploy exec async');412 });413 414 program415 .command('*')7 unmodified lines423 More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.424 425 ## License426 351-MIT352-427+[MIT](https://github.com/tj/commander.js/blob/master/LICENSE)added:tsconfig.json+20 added
1+{2+ "compilerOptions": {3+ "module": "commonjs",4+ "lib": [5+ "es6"6+ ],7+ "noImplicitAny": true,8+ "noImplicitThis": true,9+ "strictNullChecks": false,10+ "types": [11+ "node"12+ ],13+ "noEmit": true,14+ "forceConsistentCasingInFileNames": true15+ },16+ "files": [17+ "typings/index.d.ts",18+ "typings/commander-tests.ts"19+ ]20+}