Skip to content
Myr

Merge pull request #1142 from tj/develop

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Release 4.1

authored by Tomoaki Abe · committed by GitHub · parents b25cc3a, 1c66935 · Browse files · 21 files+1082 added−406 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

21 files+1082 added−406 removed

  • tests:+160 added−37 removed
  • other:+922 added−369 removed

21 files+1082 added−406 removed

added:changelogs/CHANGELOG-0.md+88 added
1# Changelog for 0.x23## 0.6.1 / 2012-06-0145* Added: append (yes or no) on confirmation6* Added: allow node.js v0.7.x78## 0.6.0 / 2012-04-10910* Added `.prompt(obj, callback)` support. Closes #4911* Added default support to .choose(). Closes #4112* Fixed the choice example1314## 0.5.1 / 2011-12-201516* Fixed `password()` for recent nodes. Closes #361718## 0.5.0 / 2011-12-041920* Added sub-command option support [itay]2122## 0.4.3 / 2011-12-042324* Fixed custom help ordering. Closes #322526## 0.4.2 / 2011-11-242728* Added travis support29* Fixed: line-buffered input automatically trimmed. Closes #313031## 0.4.1 / 2011-11-183233* Removed listening for "close" on --help3435## 0.4.0 / 2011-11-153637* Added support for `--`. Closes #243839## 0.3.3 / 2011-11-144041* Fixed: wait for close event when writing help info [Jerry Hamlet]4243## 0.3.2 / 2011-11-014445* Fixed long flag definitions with values [felixge]4647## 0.3.1 / 2011-10-314849* Changed `--version` short flag to `-V` from `-v`50* Changed `.version()` so it's configurable [felixge]5152## 0.3.0 / 2011-10-315354* Added support for long flags only. Closes #185556## 0.2.1 / 2011-10-245758* "node": ">= 0.4.x < 0.7.0". Closes #205960## 0.2.0 / 2011-09-266162* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]6364## 0.1.0 / 2011-08-246566* Added support for custom `--help` output6768## 0.0.5 / 2011-08-186970* Changed: when the user enters nothing prompt for password again71* Fixed issue with passwords beginning with numbers [NuckChorris]7273## 0.0.4 / 2011-08-157475* Fixed `Commander#args`7677## 0.0.3 / 2011-08-157879* Added default option value support8081## 0.0.2 / 2011-08-158283* Added mask support to `Command#password(str[, mask], fn)`84* Added `Command#password(str, fn)`8586## 0.0.1 / 2010-01-038788* Initial release
added:changelogs/CHANGELOG-1.md+56 added
added:examples/storeOptionsAsProperties-action.js+40 added
added:examples/storeOptionsAsProperties-opts.js+38 added
added:examples/storeOptionsAsProperties-problem.js+35 added
modified:tests/command.action.test.js+16 added
modified:tests/command.executableSubcommand.lookup.test.js+4 added-2 removed
87 unmodified lines
88 });89});9091test('when subcommand suffix is .ts then lookup succeeds', (done) => {92 jest.setTimeout(20000); // Extend timeout for GitHub Actions92 // We support looking for ts files for ts-node in particular, but don't need to test ts-node itself.93 // The program and the subcommand `pm-install.ts` are both plain JavaScript code.94 const binLinkTs = path.join(__dirname, 'fixtures-ts', 'pm.ts');94 childProcess.execFile('node', ['-r', 'ts-node/register', binLinkTs, 'install'], function(_error, stdout, stderr) {95 // childProcess.execFile('node', ['-r', 'ts-node/register', binLinkTs, 'install'], function(_error, stdout, stderr) {96 childProcess.execFile('node', [binLinkTs, 'install'], function(_error, stdout, stderr) {97 expect(stdout).toBe('install\n');98 done();99 });100});
7 unmodified lines
added:tests/commander.configureCommand.test.js+87 added
1const commander = require('../');23// Mostly testing direct on program, limited check that (sub)command working same.45// Default behaviours67test('when default then options stored on command', () => {8 const program = new commander.Command();9 program10 .option('--foo <value>', 'description');11 program.parse(['node', 'test', '--foo', 'bar']);12 expect(program.foo).toBe('bar');13});1415test('when default then command passed to action', () => {16 const program = new commander.Command();17 const callback = jest.fn();18 program19 .arguments('<value>')20 .action(callback);21 program.parse(['node', 'test', 'value']);22 expect(callback).toHaveBeenCalledWith('value', program);23});2425// storeOptionsAsProperties2627test('when storeOptionsAsProperties() then options stored on command', () => {28 const program = new commander.Command();29 program30 .storeOptionsAsProperties()31 .option('--foo <value>', 'description');32 program.parse(['node', 'test', '--foo', 'bar']);33 expect(program.foo).toBe('bar');34});3536test('when storeOptionsAsProperties(true) then options stored on command', () => {37 const program = new commander.Command();38 program39 .storeOptionsAsProperties(true)40 .option('--foo <value>', 'description');41 program.parse(['node', 'test', '--foo', 'bar']);42 expect(program.foo).toBe('bar');43});4445test('when storeOptionsAsProperties(false) then options not stored on command', () => {46 const program = new commander.Command();47 program48 .storeOptionsAsProperties(false)49 .option('--foo <value>', 'description');50 program.parse(['node', 'test', '--foo', 'bar']);51 expect(program.foo).toBeUndefined();52});5354// passCommandToAction5556test('when passCommandToAction() then command passed to action', () => {57 const program = new commander.Command();58 const callback = jest.fn();59 program60 .passCommandToAction()61 .arguments('<value>')62 .action(callback);63 program.parse(['node', 'test', 'value']);64 expect(callback).toHaveBeenCalledWith('value', program);65});6667test('when passCommandToAction(true) then command passed to action', () => {68 const program = new commander.Command();69 const callback = jest.fn();70 program71 .passCommandToAction(true)72 .arguments('<value>')73 .action(callback);74 program.parse(['node', 'test', 'value']);75 expect(callback).toHaveBeenCalledWith('value', program);76});7778test('when passCommandToAction(false) then options passed to action', () => {79 const program = new commander.Command();80 const callback = jest.fn();81 program82 .passCommandToAction(false)83 .arguments('<value>')84 .action(callback);85 program.parse(['node', 'test', 'value']);86 expect(callback).toHaveBeenCalledWith('value', program.opts());87});
modified:tests/helpwrap.test.js+4 added-4 removed
11 unmodified lines
12 const expectedOutput =13`Usage: [options]1415Options:16 -x -extra-long-option-switch kjsahdkajshkahd kajhsd akhds kashd kajhs dkha 17 dkh aksd ka dkha kdh kasd ka kahs dkh sdkh 16 -x -extra-long-option-switch kjsahdkajshkahd kajhsd akhds kashd kajhs dkha17 dkh aksd ka dkha kdh kasd ka kahs dkh sdkh18 askdh aksd kashdk ahsd kahs dkha skdh19 -h, --help output usage information20`;21
11 unmodified lines
33 const expectedOutput =34`Usage: [options]3536Options:37 -x -extra-long-option <value> kjsahdkajshkahd kajhsd akhds (default: "aaa 37 -x -extra-long-option <value> kjsahdkajshkahd kajhsd akhds (default: "aaa38 bbb ccc ddd eee fff ggg")39 -h, --help output usage information40`;41
16 unmodified lines
58 -x -extra-long-option-switch x59 -h, --help output usage information6061Commands:62 alpha Lorem mollit quis dolor ex do eu quis ad insa 62 alpha Lorem mollit quis dolor ex do eu quis ad insa63 a commodo esse.64`;6566 expect(program.helpInformation()).toBe(expectedOutput);
56 unmodified lines
modified:tests/options.opts.test.js+49 added-31 removed
10 unmodified lines
11 program.parse(['node', 'test']);12 expect(program.opts()).toEqual({ version });13});1415test('when boolean flag not specified then not in opts', () => {15test('when .version used with storeOptionsAsProperties(false) then version not in opts', () => {16 // New behaviour, stop storing version as an option value.17 const program = new commander.Command();18 const version = '0.0.1';19 program18 .option('--pepper', 'add pepper');20 .storeOptionsAsProperties(false)21 .version(version);22 program.parse(['node', 'test']);23 expect(program.opts()).toEqual({ });24});2526describe.each([true, false])('storeOptionsAsProperties is %s', (storeOptionsAsProperties) => {27 test('when boolean flag not specified then not in opts', () => {23test('when boolean flag specified then value true', () => {24 const program = new commander.Command();25 program26 .option('--pepper', 'add pepper');27 program.parse(['node', 'test', '--pepper']);28 expect(program.opts()).toEqual({ pepper: true });29});28 const program = new commander.Command();29 program.storeOptionsAsProperties(storeOptionsAsProperties);30 program31 .option('--pepper', 'add pepper');32 program.parse(['node', 'test']);33 expect(program.opts()).toEqual({ });34 });3531test('when option with required value not specified then not in opts', () => {32 const program = new commander.Command();33 program34 .option('--pepper <flavour>', 'add pepper');35 program.parse(['node', 'test']);36 expect(program.opts()).toEqual({ });37});36 test('when boolean flag specified then value true', () => {37 const program = new commander.Command();38 program.storeOptionsAsProperties(storeOptionsAsProperties);39 program40 .option('--pepper', 'add pepper');41 program.parse(['node', 'test', '--pepper']);42 expect(program.opts()).toEqual({ pepper: true });43 });4439test('when option with required value specified then value as specified', () => {40 const pepperValue = 'red';41 const program = new commander.Command();42 program43 .option('--pepper <flavour>', 'add pepper');44 program.parse(['node', 'test', '--pepper', pepperValue]);45 expect(program.opts()).toEqual({ pepper: pepperValue });46});45 test('when option with required value not specified then not in opts', () => {46 const program = new commander.Command();47 program.storeOptionsAsProperties(storeOptionsAsProperties);48 program49 .option('--pepper <flavour>', 'add pepper');50 program.parse(['node', 'test']);51 expect(program.opts()).toEqual({ });52 });5348test('when option with default value not specified then default value in opts', () => {49 const pepperDefault = 'red';50 const program = new commander.Command();51 program52 .option('--pepper <flavour>', 'add pepper', pepperDefault);53 program.parse(['node', 'test']);54 expect(program.opts()).toEqual({ pepper: pepperDefault });54 test('when option with required value specified then value as specified', () => {55 const pepperValue = 'red';56 const program = new commander.Command();57 program.storeOptionsAsProperties(storeOptionsAsProperties);58 program59 .option('--pepper <flavour>', 'add pepper');60 program.parse(['node', 'test', '--pepper', pepperValue]);61 expect(program.opts()).toEqual({ pepper: pepperValue });62 });6364 test('when option with default value not specified then default value in opts', () => {65 const pepperDefault = 'red';66 const program = new commander.Command();67 program.storeOptionsAsProperties(storeOptionsAsProperties);68 program69 .option('--pepper <flavour>', 'add pepper', pepperDefault);70 program.parse(['node', 'test']);71 expect(program.opts()).toEqual({ pepper: pepperDefault });72 });73});
modified:typings/commander-tests.ts+9 added
8 unmodified lines
9const errorInstance = new program.CommanderError(1, 'code', 'message');1011const name = program.name();1213program.storeOptionsAsProperties(true);14program.passCommandToAction(true);1516program17 .name('set name')18 .version('0.0.1')19 .option('-p, --peppers', 'Add peppers')
112 unmodified lines
132});133134program.parse(process.argv);135136program.parseAsync(process.argv).then(() => {137 console.log('parseAsync success');138}).catch(err => {139 console.log('parseAsync failed');140});141142console.log('stuff');
modified:typings/index.d.ts+55 added-46 removed
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/DefinitelyTyped1// Type definitions for commander2// Original 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>34///<reference types="node" />56declare namespace commander {
29 unmodified lines
36 * This method auto-registers the "-V, --version" flag37 * which will print the version number when passed.38 * 39 * You can optionally supply the flags and description to override the defaults.42 *40 */41 version(str: string, flags?: string, description?: string): Command;4243 /**
39 unmodified lines
8384 /**85 * Define argument syntax for the top-level command.86 *90 * @param {string} desc91 * @returns {Command} for chaining87 * @returns Command for chaining88 */89 arguments(desc: string): Command;9091 /**92 * Parse expected `args`.93 *94 * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.95 *100 * @param {string[]} args101 * @returns {Command} for chaining96 * @returns Command for chaining97 */98 parseExpectedArgs(args: string[]): Command;99100 /**
11 unmodified lines
112 * .action(function() {113 * // output help here114 * });115 *121 * @param {(...args: any[]) => void} fn122 * @returns {Command} for chaining116 * @returns Command for chaining117 */118 action(fn: (...args: any[]) => void): Command;119120 /**
35 unmodified lines
156 *157 * // optional argument158 * program.option('-c, --cheese [type]', 'add cheese [marble]');159 *166 * @param {string} flags167 * @param {string} [description]168 * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default169 * @param {*} [defaultValue]170 * @returns {Command} for chaining160 * @returns Command for chaining161 */162 option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;163 option(flags: string, description?: string, defaultValue?: any): Command;164
5 unmodified lines
170 */171 requiredOption(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;172 requiredOption(flags: string, description?: string, defaultValue?: any): Command;173174175 /**176 * Whether to store option values as properties on command object,177 * or store separately (specify false). In both cases the option values can be accessed using .opts().178 *179 * @return Command for chaining180 */181 storeOptionsAsProperties(value?: boolean): Command;182183 /**184 * Whether to pass command to action handler,185 * or just the options (specify false).186 * 187 * @return Command for chaining188 */189 passCommandToAction(value?: boolean): Command;190191 /**192 * Allow unknown options on the command line.193 *187 * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options.188 * @returns {Command} for chaining194 * @param [arg] if `true` or omitted, no error will be thrown for unknown options.195 * @returns Command for chaining196 */197 allowUnknownOption(arg?: boolean): Command;198199 /**193 * Parse `argv`, settings options and invoking commands when defined.200 * Parse `argv`, setting options and invoking commands when defined.201 *195 * @param {string[]} argv196 * @returns {Command} for chaining202 * @returns Command for chaining203 */204 parse(argv: string[]): Command;205206 /**201 * Parse options from `argv` returning `argv` void of these options.207 * Parse `argv`, setting options and invoking commands when defined.208 * 209 * Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise.210 *203 * @param {string[]} argv204 * @returns {ParseOptionsResult}211 * @returns Promise212 */213 parseAsync(argv: string[]): Promise<any>;214215 /**216 * Parse options from `argv` returning `argv` void of these options.217 */218 parseOptions(argv: string[]): commander.ParseOptionsResult;219220 /**221 * Return an object containing options as key-value pairs210 *211 * @returns {{[key: string]: any}}222 */223 opts(): { [key: string]: any };224225 /**216 * Set the description to `str`.217 *218 * @param {string} str219 * @param {{[argName: string]: string}} argsDescription220 * @return {(Command | string)}226 * Set the description.227 * 228 * @returns Command for chaining229 */230 description(str: string, argsDescription?: {[argName: string]: string}): Command;231 /**232 * Get the description.233 */234 description(): string;235236 /**237 * Set an alias for the command.227 *228 * @param {string} alias229 * @return {(Command | string)}238 * 239 * @returns Command for chaining240 */241 alias(alias: string): Command;242 /**243 * Get alias for the command.244 */245 alias(): string;246247 /**235 * Set or get the command usage.236 *237 * @param {string} str238 * @return {(Command | string)}248 * Set the command usage.249 * 250 * @returns Command for chaining251 */252 usage(str: string): Command;253 /**254 * Get the command usage.255 */256 usage(): string;257258 /**259 * Set the name of the command.245 *246 * @param {string} str247 * @return {Command}260 * 261 * @returns Command for chaining262 */263 name(str: string): Command;250264 /**265 * Get the name of the command.253 *254 * @return {string}266 */267 name(): string;268269 /**270 * Output help information for this command.271 *272 * When listener(s) are available for the helpLongFlag273 * those callbacks are invoked.263 * 264 * @param {(str: string) => string} [cb]274 */275 outputHelp(cb?: (str: string) => string): void;276277 /**
34 unmodified lines
added:.eslintignore+2 added
1# We have not configured eslint for TypeScript so avoid bogus error messages in the test file and typings file.2**/*.ts
modified:.eslintrc.json+2 added-1 removed
2 unmodified lines
3 "plugins": ["jest"],4 "rules": {5 "one-var": "off",6 "semi": ["error", "always"],7 "space-before-function-paren": ["error", "never"]7 "space-before-function-paren": ["error", "never"],8 "no-else-return": ["error", { "allowElseIf": false }]9 }10}
modified:CHANGELOG.md+30 added-141 removed
5 unmodified lines
6and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). (Format adopted after v3.0.0.)78<!-- markdownlint-disable MD024 -->910## [4.1.0] (2020-01-06)1112### Added1314- two routines to change how option values are handled, and eliminate name clashes with command properties ([#933] [#1102])15 - see storeOptionsAsProperties and passCommandToAction in README16- `.parseAsync` to use instead of `.parse` if supply async action handlers ([#806] [#1118])1718### Fixed1920- Remove trailing blanks from wrapped help text ([#1096])2122### Changed2324- update dependencies25- extend security coverage for Commander 2.x to 2020-02-0326- improvements to README27- improvements to TypeScript definition documentation28- move old versions out of main CHANGELOG29- removed explicit use of `ts-node` in tests3031## [4.0.1] (2019-11-12)3233### Fixed3414* display help when requested, even if there are missing required options [(#1091)]35* display help when requested, even if there are missing required options ([#1091])3637## [4.0.0] (2019-11-02)3839### Added
335 unmodified lines
375## 2.0.0 / 2013-07-18376377* remove input methods (.prompt, .confirm, etc)378358## 1.3.2 / 2013-07-18379## Older versions380360* add support for sub-commands to co-exist with the original command381* [1.x](./changelogs/CHANGELOG-1.md)382* [0.x](./changelogs/CHANGELOG-0.md)383362## 1.3.1 / 2013-07-18363364* add quick .runningCommand hack so you can opt-out of other logic when running a sub command365366## 1.3.0 / 2013-07-09367368* add EACCES error handling369* fix sub-command --help370371## 1.2.0 / 2013-06-13372373* allow "-" hyphen as an option argument374* support for RegExp coercion375376## 1.1.1 / 2012-11-20377378* add more sub-command padding379* fix .usage() when args are present. Closes #106380381## 1.1.0 / 2012-11-16382383* add git-style executable subcommand support. Closes #94384385## 1.0.5 / 2012-10-09386387* fix `--name` clobbering. Closes #92388* fix examples/help. Closes #89389390## 1.0.4 / 2012-09-03391392* add `outputHelp()` method.393394## 1.0.3 / 2012-08-30395396* remove invalid .version() defaulting397398## 1.0.2 / 2012-08-24399400* add `--foo=bar` support [arv]401* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]402403## 1.0.1 / 2012-08-03404405* fix issue #56406* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())407408## 1.0.0 / 2012-07-05409410* add support for optional option descriptions411* add defaulting of `.version()` to package.json's version412413## 0.6.1 / 2012-06-01414415* Added: append (yes or no) on confirmation416* Added: allow node.js v0.7.x417418## 0.6.0 / 2012-04-10419420* Added `.prompt(obj, callback)` support. Closes #49421* Added default support to .choose(). Closes #41422* Fixed the choice example423424## 0.5.1 / 2011-12-20425426* Fixed `password()` for recent nodes. Closes #36427428## 0.5.0 / 2011-12-04429430* Added sub-command option support [itay]431432## 0.4.3 / 2011-12-04433434* Fixed custom help ordering. Closes #32435436## 0.4.2 / 2011-11-24437438* Added travis support439* Fixed: line-buffered input automatically trimmed. Closes #31440441## 0.4.1 / 2011-11-18442443* Removed listening for "close" on --help444445## 0.4.0 / 2011-11-15446447* Added support for `--`. Closes #24448449## 0.3.3 / 2011-11-14450451* Fixed: wait for close event when writing help info [Jerry Hamlet]452453## 0.3.2 / 2011-11-01454455* Fixed long flag definitions with values [felixge]456457## 0.3.1 / 2011-10-31458459* Changed `--version` short flag to `-V` from `-v`460* Changed `.version()` so it's configurable [felixge]461462## 0.3.0 / 2011-10-31463464* Added support for long flags only. Closes #18465466## 0.2.1 / 2011-10-24467468* "node": ">= 0.4.x < 0.7.0". Closes #20469470## 0.2.0 / 2011-09-26471472* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]473474## 0.1.0 / 2011-08-24475476* Added support for custom `--help` output477478## 0.0.5 / 2011-08-18479480* Changed: when the user enters nothing prompt for password again481* Fixed issue with passwords beginning with numbers [NuckChorris]482483## 0.0.4 / 2011-08-15484485* Fixed `Commander#args`486487## 0.0.3 / 2011-08-15488489* Added default option value support490491## 0.0.2 / 2011-08-15492493* Added mask support to `Command#password(str[, mask], fn)`494* Added `Command#password(str, fn)`495496## 0.0.1 / 2010-01-03497498* Initial release499384[#599]: https://github.com/tj/commander.js/issues/599385[#611]: https://github.com/tj/commander.js/issues/611386[#697]: https://github.com/tj/commander.js/issues/697387[#795]: https://github.com/tj/commander.js/issues/795388[#806]: https://github.com/tj/commander.js/issues/806389[#915]: https://github.com/tj/commander.js/issues/915390[#938]: https://github.com/tj/commander.js/issues/938391[#963]: https://github.com/tj/commander.js/issues/963392[#974]: https://github.com/tj/commander.js/issues/974393[#980]: https://github.com/tj/commander.js/issues/980394[#987]: https://github.com/tj/commander.js/issues/987395[#990]: https://github.com/tj/commander.js/issues/990396[#991]: https://github.com/tj/commander.js/issues/991397[#993]: https://github.com/tj/commander.js/issues/993398[#999]: https://github.com/tj/commander.js/issues/999399[#1010]: https://github.com/tj/commander.js/pull/1010400[#1018]: https://github.com/tj/commander.js/pull/1018401[#1026]: https://github.com/tj/commander.js/pull/1026
9 unmodified lines
411[#1053]: https://github.com/tj/commander.js/pull/1053412[#1071]: https://github.com/tj/commander.js/pull/1071413[#1081]: https://github.com/tj/commander.js/pull/1081414[#1091]: https://github.com/tj/commander.js/pull/1091415[#1096]: https://github.com/tj/commander.js/pull/1096416[#1102]: https://github.com/tj/commander.js/pull/1102417[#1118]: https://github.com/tj/commander.js/pull/1118418419[Unreleased]: https://github.com/tj/commander.js/compare/master...develop420[4.0.1]: https://github.com/tj/commander.js/compare/v4.0.0..v4.0.1421[4.0.0]: https://github.com/tj/commander.js/compare/v3.0.2..v4.0.0
6 unmodified lines
modified:index.js+136 added-37 removed
113 unmodified lines
114115/**116 * Initialize a new `Command`.117 *118 * @param {String} name118 * @param {String} [name]119 * @api public120 */121122function Command(name) {
2 unmodified lines
125 this._execs = new Set();126 this._allowUnknownOption = false;127 this._args = [];128 this._name = name || '';129 this._optionValues = {};130 this._storeOptionsAsProperties = true; // backwards compatible by default131 this._passCommandToAction = true; // backwards compatible by default132 this._actionResults = [];133134 this._helpFlags = '-h, --help';135 this._helpDescription = 'output usage information';136 this._helpShortFlag = '-h';
17 unmodified lines
154 *155 * // Command implemented using separate executable file (description is second parameter to `.command`)156 * program157 * .command('start <service>', 'start named service')154 * .command('stop [service]', 'stop named serice, or all if no name supplied');158 * .command('stop [service]', 'stop named service, or all if no name supplied');159 *160 * @param {string} nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`161 * @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)162 * @param {Object} [execOpts] - configuration options (for executable)
23 unmodified lines
186 cmd._helpDescription = this._helpDescription;187 cmd._helpShortFlag = this._helpShortFlag;188 cmd._helpLongFlag = this._helpLongFlag;189 cmd._exitCallback = this._exitCallback;190 cmd._storeOptionsAsProperties = this._storeOptionsAsProperties;191 cmd._passCommandToAction = this._passCommandToAction;192193 cmd._executableFile = opts.executableFile; // Custom name for executable file194 this.commands.push(cmd);195 cmd.parseExpectedArgs(args);
132 unmodified lines
328329 var parsed = self.parseOptions(unknown);330331 // Output help if necessary326 outputHelpIfNecessary(self, parsed.unknown);332 outputHelpIfRequested(self, parsed.unknown);333 self._checkForMissingMandatoryOptions();334335 // If there are still any unknown options, then we simply336 // die, unless someone asked for help, in which case we give it
19 unmodified lines
356357 // The .action callback takes an extra parameter which is the command itself.358 var expectedArgsCount = self._args.length;359 var actionArgs = args.slice(0, expectedArgsCount);360 if (self._passCommandToAction) {354 actionArgs[expectedArgsCount] = self;361 actionArgs[expectedArgsCount] = self;362 } else {363 actionArgs[expectedArgsCount] = self.opts();364 }365 // Add the extra arguments so available too.366 if (args.length > expectedArgsCount) {367 actionArgs.push(args.slice(expectedArgsCount));368 }369360 fn.apply(self, actionArgs);370 const actionResult = fn.apply(self, actionArgs);371 // Remember result in case it is async. Assume parseAsync getting called on root.372 let rootCommand = self;373 while (rootCommand.parent) {374 rootCommand = rootCommand.parent;375 }376 rootCommand._actionResults.push(actionResult);377 };378 var parent = this.parent || this;379 var name = parent === this ? '*' : this._name;380 parent.on('command:' + name, listener);
39 unmodified lines
420 // preassign default value for --no-*, [optional], <required>, or plain flag if boolean value421 if (option.negate || option.optional || option.required || typeof defaultValue === 'boolean') {422 // when --no-foo we make sure default is true, unless a --foo option is already defined423 if (option.negate) {408 var opts = self.opts();409 defaultValue = Object.prototype.hasOwnProperty.call(opts, name) ? opts[name] : true;424 const positiveLongFlag = option.long.replace(/^--no-/, '--');425 defaultValue = self.optionFor(positiveLongFlag) ? self._getOptionValue(name) : true;426 }427 // preassign only if we have a default428 if (defaultValue !== undefined) {413 self[name] = defaultValue;429 self._setOptionValue(name, defaultValue);430 option.defaultValue = defaultValue;431 }432 }433
4 unmodified lines
438 // and conditionally invoke the callback439 this.on('option:' + oname, function(val) {440 // coercion441 if (val !== null && fn) {426 val = fn(val, self[name] === undefined ? defaultValue : self[name]);442 val = fn(val, self._getOptionValue(name) === undefined ? defaultValue : self._getOptionValue(name));443 }444445 // unassigned or boolean value430 if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') {446 if (typeof self._getOptionValue(name) === 'boolean' || typeof self._getOptionValue(name) === 'undefined') {447 // if no value, negate false, and we have a default, then use it!448 if (val == null) {433 self[name] = option.negate449 self._setOptionValue(name, option.negate450 ? false435 : defaultValue || true;451 : defaultValue || true);452 } else {437 self[name] = val;453 self._setOptionValue(name, val);454 }455 } else if (val !== null) {456 // reassign441 self[name] = option.negate ? false : val;457 self._setOptionValue(name, option.negate ? false : val);458 }459 });460461 return this;
85 unmodified lines
547 return this;548};549550/**535 * Parse `argv`, settings options and invoking commands when defined.551 * Whether to store option values as properties on command object,552 * or store separately (specify false). In both cases the option values can be accessed using .opts().553 *554 * @param {boolean} value555 * @return {Command} Command for chaining556 * @api public557 */558559Command.prototype.storeOptionsAsProperties = function(value) {560 this._storeOptionsAsProperties = (value === undefined) || value;561 if (this.options.length) {562 // This is for programmer, not end user.563 console.error('Commander usage error: call storeOptionsAsProperties before adding options');564 }565 return this;566};567568/**569 * Whether to pass command to action handler,570 * or just the options (specify false).571 *572 * @param {boolean} value573 * @return {Command} Command for chaining574 * @api public575 */576577Command.prototype.passCommandToAction = function(value) {578 this._passCommandToAction = (value === undefined) || value;579 return this;580};581582/**583 * Store option value584 *585 * @param {String} key586 * @param {Object} value587 * @api private588 */589590Command.prototype._setOptionValue = function(key, value) {591 if (this._storeOptionsAsProperties) {592 this[key] = value;593 } else {594 this._optionValues[key] = value;595 }596};597598/**599 * Retrieve option value600 *601 * @param {String} key602 * @return {Object} value603 * @api private604 */605606Command.prototype._getOptionValue = function(key) {607 if (this._storeOptionsAsProperties) {608 return this[key];609 }610 return this._optionValues[key];611};612613/**614 * Parse `argv`, setting options and invoking commands when defined.615 *616 * @param {Array} argv617 * @return {Command} for chaining618 * @api public619 */
75 unmodified lines
695 return result;696};697698/**699 * Parse `argv`, setting options and invoking commands when defined.700 *701 * Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise.702 *703 * @param {Array} argv704 * @return {Promise}705 * @api public706 */707Command.prototype.parseAsync = function(argv) {708 this.parse(argv);709 return Promise.all(this._actionResults);710};711712/**713 * Execute a sub-command executable.714 *715 * @param {Array} argv716 * @param {Array} args717 * @param {Array} unknown625 * @param {String} specifySubcommand718 * @param {String} executableFile719 * @api private720 */721722Command.prototype.executeSubCommand = function(argv, args, unknown, executableFile) {
170 unmodified lines
893 } else {894 this.emit('command:*', args, unknown);895 }896 } else {804 outputHelpIfNecessary(this, unknown);897 outputHelpIfRequested(this, unknown);898899 // If there were no args and we have unknown options,900 // then they are extraneous and we need to error.901 if (unknown.length > 0 && !this.defaultExecutable) {
33 unmodified lines
935Command.prototype._checkForMissingMandatoryOptions = function() {936 // Walk up hierarchy so can call from action handler after checking for displaying help.937 for (var cmd = this; cmd; cmd = cmd.parent) {938 cmd.options.forEach((anOption) => {846 if (anOption.mandatory && (cmd[anOption.attributeName()] === undefined)) {939 if (anOption.mandatory && (cmd._getOptionValue(anOption.attributeName()) === undefined)) {940 cmd.missingMandatoryOptionValue(anOption);941 }942 });943 }
3 unmodified lines
947 * Parse options from `argv` returning `argv`948 * void of these options.949 *950 * @param {Array} argv858 * @return {Array}951 * @return {{args: Array, unknown: Array}}952 * @api public953 */954955Command.prototype.parseOptions = function(argv) {
72 unmodified lines
1028 * @return {Object}1029 * @api public1030 */1031Command.prototype.opts = function() {1032 if (this._storeOptionsAsProperties) {1033 // Preserve original behaviour so backwards compatible when still using properties939 var result = {},940 len = this.options.length;1034 var result = {},1035 len = this.options.length;1036942 for (var i = 0; i < len; i++) {943 var key = this.options[i].attributeName();944 result[key] = key === this._versionOptionName ? this._version : this[key];1037 for (var i = 0; i < len; i++) {1038 var key = this.options[i].attributeName();1039 result[key] = key === this._versionOptionName ? this._version : this[key];1040 }1041 return result;1042 }946 return result;10431044 return this._optionValues;1045};10461047/**1048 * Argument `name` is missing.
10 unmodified lines
10591060/**1061 * `Option` is missing an argument, but received `flag` or nothing.1062 *965 * @param {String} option966 * @param {String} flag1063 * @param {Option} option1064 * @param {String} [flag]1065 * @api private1066 */10671068Command.prototype.optionMissingArgument = function(option, flag) {
9 unmodified lines
10781079/**1080 * `Option` does not have a value, and is a mandatory option.1081 *984 * @param {String} option1082 * @param {Option} option1083 * @api private1084 */10851086Command.prototype.missingMandatoryOptionValue = function(option) {
51 unmodified lines
1138 description = description || 'output the version number';1139 var versionOption = new Option(flags, description);1140 this._versionOptionName = versionOption.long.substr(2) || 'version';1141 this.options.push(versionOption);1142 var self = this;1143 this.on('option:' + this._versionOptionName, function() {1144 process.stdout.write(str + '\n');1046 this._exit(0, 'commander.version', str);1145 self._exit(0, 'commander.version', str);1146 });1147 return this;1148};11491150/**1151 * Set the description to `str`.1152 *1153 * @param {String} str1055 * @param {Object} argsDescription1154 * @param {Object} [argsDescription]1155 * @return {String|Command}1156 * @api public1157 */1158
28 unmodified lines
11871188/**1189 * Set / get the command usage `str`.1190 *1092 * @param {String} str1191 * @param {String} [str]1192 * @return {String|Command}1193 * @api public1194 */1195
14 unmodified lines
12101211/**1212 * Get or set the name of the command1213 *1115 * @param {String} str1214 * @param {String} [str]1215 * @return {String|Command}1216 * @api public1217 */1218
308 unmodified lines
1527 return lines.map(function(line, i) {1528 if (line.slice(-1) === '\n') {1529 line = line.slice(0, line.length - 1);1530 }1432 return ((i > 0 && indent) ? Array(indent + 1).join(' ') : '') + line;1531 return ((i > 0 && indent) ? Array(indent + 1).join(' ') : '') + line.trimRight();1532 }).join('\n');1533}15341535/**
18 unmodified lines
1554 return wrap(str, width, indent);1555}15561557/**1459 * Output help information if necessary1558 * Output help information if help flags specified1559 *1461 * @param {Command} command to output help for1462 * @param {Array} array of options to search for -h or --help1560 * @param {Command} cmd - command to output help for1561 * @param {Array} options - array of options to search for -h or --help1562 * @api private1563 */15641466function outputHelpIfNecessary(cmd, options) {1565function outputHelpIfRequested(cmd, options) {1566 options = options || [];15671568 for (var i = 0; i < options.length; i++) {1569 if (options[i] === cmd._helpLongFlag || options[i] === cmd._helpShortFlag) {
80 unmodified lines
modified:package-lock.json+302 added-125 removed
1{2 "name": "commander",3 "version": "4.0.1",3 "version": "4.1.0",4 "lockfileVersion": 1,5 "requires": true,6 "dependencies": {7 "@babel/code-frame": {
424 unmodified lines
432 "@types/istanbul-lib-report": "*"433 }434 },435 "@types/jest": {436 "version": "24.0.18",437 "resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.18.tgz",438 "integrity": "sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ==",436 "version": "24.0.23",437 "resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.23.tgz",438 "integrity": "sha512-L7MBvwfNpe7yVPTXLn32df/EK+AMBFAFvZrRuArGs7npEWnlziUXK+5GMIUTI4NIuwok3XibsjXCs5HxviYXjg==",439 "dev": true,440 "requires": {441 "@types/jest-diff": "*"441 "jest-diff": "^24.3.0"442 }443 },444 "@types/jest-diff": {445 "version": "20.0.1",446 "resolved": "https://registry.npmjs.org/@types/jest-diff/-/jest-diff-20.0.1.tgz",447 "integrity": "sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA==",448 "dev": true449 },444 "@types/json-schema": {445 "version": "7.0.3",446 "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.3.tgz",447 "integrity": "sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==",448 "dev": true449 },450 "@types/node": {457 "version": "12.7.8",458 "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.8.tgz",459 "integrity": "sha512-FMdVn84tJJdV+xe+53sYiZS4R5yn1mAIxfj+DVoNiQjTYz1+OYmjwEZr1ev9nU0axXwda0QDbYl06QHanRVH3A==",451 "version": "12.12.11",452 "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.11.tgz",453 "integrity": "sha512-O+x6uIpa6oMNTkPuHDa9MhMMehlxLAd5QcOvKRjAFsBVpeFWTOPnXbDvILvFgFFZfQ1xh1EZi1FbXxUix+zpsQ==",454 "dev": true455 },456 "@types/stack-utils": {457 "version": "1.0.1",
87 unmodified lines
545 }546 }547 },548 "acorn-jsx": {555 "version": "5.0.2",556 "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.2.tgz",557 "integrity": "sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw==",549 "version": "5.1.0",550 "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz",551 "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==",552 "dev": true553 },554 "acorn-walk": {555 "version": "6.2.0",
43 unmodified lines
599 "micromatch": "^3.1.4",600 "normalize-path": "^2.1.1"601 }602 },609 "arg": {610 "version": "4.1.1",611 "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.1.tgz",612 "integrity": "sha512-SlmP3fEA88MBv0PypnXZ8ZfJhwmDeIE3SP71j37AiXQBXYosPV0x6uISAaHYSlSVhmHOVkomen0tbGk6Anlebw==",613 "dev": true614 },603 "argparse": {604 "version": "1.0.10",605 "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",606 "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
382 unmodified lines
989 }990 }991 },992 "cli-cursor": {1005 "version": "2.1.0",1006 "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",1007 "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",993 "version": "3.1.0",994 "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",995 "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",996 "dev": true,997 "requires": {1010 "restore-cursor": "^2.0.0"998 "restore-cursor": "^3.1.0"999 }1000 },1001 "cli-width": {1002 "version": "2.2.0",
65 unmodified lines
1068 "delayed-stream": "~1.0.0"1069 }1070 },1071 "commander": {1084 "version": "2.20.0",1085 "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",1086 "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",1072 "version": "2.20.3",1073 "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",1074 "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",1075 "dev": true,1076 "optional": true1077 },1078 "component-emitter": {
220 unmodified lines
1299 "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz",1300 "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=",1301 "dev": true1302 },1315 "diff": {1316 "version": "4.0.1",1317 "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",1318 "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==",1319 "dev": true1320 },1303 "diff-sequences": {1304 "version": "24.9.0",1305 "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz",1306 "integrity": "sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==",
107 unmodified lines
1414 }1415 }1416 },1417 "eslint": {1436 "version": "6.4.0",1437 "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.4.0.tgz",1438 "integrity": "sha512-WTVEzK3lSFoXUovDHEbkJqCVPEPwbhCq4trDktNI6ygs7aO41d4cDT0JFAT5MivzZeVLWlg7vHL+bgrQv/t3vA==",1418 "version": "6.7.0",1419 "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.7.0.tgz",1420 "integrity": "sha512-dQpj+PaHKHfXHQ2Imcw5d853PTvkUGbHk/MR68KQUl98EgKDCdh4vLRH1ZxhqeQjQFJeg8fgN0UwmNhN3l8dDQ==",1421 "dev": true,1422 "requires": {1423 "@babel/code-frame": "^7.0.0",1424 "ajv": "^6.10.0",
1 unmodified line
1426 "cross-spawn": "^6.0.5",1427 "debug": "^4.0.1",1428 "doctrine": "^3.0.0",1429 "eslint-scope": "^5.0.0",1448 "eslint-utils": "^1.4.2",1430 "eslint-utils": "^1.4.3",1431 "eslint-visitor-keys": "^1.1.0",1450 "espree": "^6.1.1",1432 "espree": "^6.1.2",1433 "esquery": "^1.0.1",1434 "esutils": "^2.0.2",1435 "file-entry-cache": "^5.0.1",1436 "functional-red-black-tree": "^1.0.1",1437 "glob-parent": "^5.0.0",1456 "globals": "^11.7.0",1438 "globals": "^12.1.0",1439 "ignore": "^4.0.6",1440 "import-fresh": "^3.0.0",1441 "imurmurhash": "^0.1.4",1460 "inquirer": "^6.4.1",1442 "inquirer": "^7.0.0",1443 "is-glob": "^4.0.0",1444 "js-yaml": "^3.13.1",1445 "json-stable-stringify-without-jsonify": "^1.0.1",1446 "levn": "^0.3.0",1447 "lodash": "^4.17.14",1448 "minimatch": "^3.0.4",1449 "mkdirp": "^0.5.1",1450 "natural-compare": "^1.4.0",1469 "optionator": "^0.8.2",1451 "optionator": "^0.8.3",1452 "progress": "^2.0.0",1453 "regexpp": "^2.0.1",1454 "semver": "^6.1.2",1455 "strip-ansi": "^5.2.0",1456 "strip-json-comments": "^3.0.1",1457 "table": "^5.2.3",1458 "text-table": "^0.2.0",1459 "v8-compile-cache": "^2.0.3"1460 },1461 "dependencies": {1462 "eslint-utils": {1463 "version": "1.4.3",1464 "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz",1465 "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==",1466 "dev": true,1467 "requires": {1468 "eslint-visitor-keys": "^1.1.0"1469 }1470 },1471 "globals": {1472 "version": "12.3.0",1473 "resolved": "https://registry.npmjs.org/globals/-/globals-12.3.0.tgz",1474 "integrity": "sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==",1475 "dev": true,1476 "requires": {1477 "type-fest": "^0.8.1"1478 }1479 },1480 "optionator": {1481 "version": "0.8.3",1482 "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",1483 "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",1484 "dev": true,1485 "requires": {1486 "deep-is": "~0.1.3",1487 "fast-levenshtein": "~2.0.6",1488 "levn": "~0.3.0",1489 "prelude-ls": "~1.1.2",1490 "type-check": "~0.3.2",1491 "word-wrap": "~1.2.3"1492 }1493 },1494 "type-fest": {1495 "version": "0.8.1",1496 "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",1497 "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",1498 "dev": true1499 }1500 }1501 },1502 "eslint-config-standard": {1503 "version": "14.1.0",
277 unmodified lines
1781 }1782 }1783 },1784 "eslint-plugin-jest": {1763 "version": "22.17.0",1764 "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-22.17.0.tgz",1765 "integrity": "sha512-WT4DP4RoGBhIQjv+5D0FM20fAdAUstfYAf/mkufLNTojsfgzc5/IYW22cIg/Q4QBavAZsROQlqppiWDpFZDS8Q==",1785 "version": "22.21.0",1786 "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-22.21.0.tgz",1787 "integrity": "sha512-OaqnSS7uBgcGiqXUiEnjoqxPNKvR4JWG5mSRkzVoR6+vDwlqqp11beeql1hYs0HTbdhiwrxWLxbX0Vx7roG3Ew==",1788 "dev": true,1789 "requires": {1790 "@typescript-eslint/experimental-utils": "^1.13.0"1791 }
85 unmodified lines
1877 "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==",1878 "dev": true1879 },1880 "espree": {1859 "version": "6.1.1",1860 "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.1.tgz",1861 "integrity": "sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ==",1881 "version": "6.1.2",1882 "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz",1883 "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==",1884 "dev": true,1885 "requires": {1864 "acorn": "^7.0.0",1865 "acorn-jsx": "^5.0.2",1886 "acorn": "^7.1.0",1887 "acorn-jsx": "^5.1.0",1888 "eslint-visitor-keys": "^1.1.0"1889 }1890 },1891 "esprima": {
259 unmodified lines
2151 "bser": "^2.0.0"2152 }2153 },2154 "figures": {2133 "version": "2.0.0",2134 "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",2135 "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",2155 "version": "3.1.0",2156 "resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz",2157 "integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==",2158 "dev": true,2159 "requires": {2160 "escape-string-regexp": "^1.0.5"2161 }
737 unmodified lines
2899 "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=",2900 "dev": true2901 },2902 "handlebars": {2881 "version": "4.3.3",2882 "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.3.3.tgz",2883 "integrity": "sha512-VupOxR91xcGojfINrzMqrvlyYbBs39sXIrWa7YdaQWeBudOlvKEGvCczMfJPgnuwHE/zyH1M6J+IUP6cgDVyxg==",2903 "version": "4.5.3",2904 "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",2905 "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",2906 "dev": true,2907 "requires": {2908 "neo-async": "^2.6.0",2909 "optimist": "^0.6.1",
111 unmodified lines
3021 "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",3022 "dev": true3023 },3024 "import-fresh": {3003 "version": "3.1.0",3004 "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz",3005 "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==",3025 "version": "3.2.1",3026 "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",3027 "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==",3028 "dev": true,3029 "requires": {3030 "parent-module": "^1.0.0",3031 "resolve-from": "^4.0.0"
31 unmodified lines
3063 "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",3064 "dev": true3065 },3066 "inquirer": {3045 "version": "6.5.2",3046 "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz",3047 "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==",3067 "version": "7.0.0",3068 "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.0.tgz",3069 "integrity": "sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ==",3070 "dev": true,3071 "requires": {3050 "ansi-escapes": "^3.2.0",3072 "ansi-escapes": "^4.2.1",3073 "chalk": "^2.4.2",3052 "cli-cursor": "^2.1.0",3074 "cli-cursor": "^3.1.0",3075 "cli-width": "^2.0.0",3076 "external-editor": "^3.0.3",3055 "figures": "^2.0.0",3056 "lodash": "^4.17.12",3057 "mute-stream": "0.0.7",3077 "figures": "^3.0.0",3078 "lodash": "^4.17.15",3079 "mute-stream": "0.0.8",3080 "run-async": "^2.2.0",3081 "rxjs": "^6.4.0",3060 "string-width": "^2.1.0",3082 "string-width": "^4.1.0",3083 "strip-ansi": "^5.1.0",3084 "through": "^2.3.6"3085 },3086 "dependencies": {3087 "ansi-escapes": {3088 "version": "4.3.0",3089 "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz",3090 "integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==",3091 "dev": true,3092 "requires": {3093 "type-fest": "^0.8.1"3094 }3095 },3096 "type-fest": {3097 "version": "0.8.1",3098 "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",3099 "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",3100 "dev": true3101 }3102 }3103 },3104 "invariant": {3105 "version": "2.2.4",
958 unmodified lines
4064 "dev": true4065 }4066 }4067 },4029 "make-error": {4030 "version": "1.3.5",4031 "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz",4032 "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==",4033 "dev": true4034 },4068 "makeerror": {4069 "version": "1.0.11",4070 "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz",4071 "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=",
59 unmodified lines
4131 "mime-db": "1.40.0"4132 }4133 },4134 "mimic-fn": {4102 "version": "1.2.0",4103 "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",4104 "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",4135 "version": "2.1.0",4136 "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",4137 "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",4138 "dev": true4139 },4140 "minimatch": {4141 "version": "3.0.4",
46 unmodified lines
4188 "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",4189 "dev": true4190 },4191 "mute-stream": {4159 "version": "0.0.7",4160 "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",4161 "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",4192 "version": "0.0.8",4193 "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",4194 "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",4195 "dev": true4196 },4197 "nan": {4198 "version": "2.14.0",
256 unmodified lines
4455 "wrappy": "1"4456 }4457 },4458 "onetime": {4426 "version": "2.0.1",4427 "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",4428 "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",4459 "version": "5.1.0",4460 "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz",4461 "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==",4462 "dev": true,4463 "requires": {4431 "mimic-fn": "^1.0.0"4464 "mimic-fn": "^2.1.0"4465 }4466 },4467 "optimist": {4468 "version": "0.6.1",
493 unmodified lines
4962 "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=",4963 "dev": true4964 },4965 "restore-cursor": {4933 "version": "2.0.0",4934 "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",4935 "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",4966 "version": "3.1.0",4967 "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",4968 "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",4969 "dev": true,4970 "requires": {4938 "onetime": "^2.0.0",4971 "onetime": "^5.1.0",4972 "signal-exit": "^3.0.2"4973 }4974 },4975 "ret": {
425 unmodified lines
5401 "eslint-plugin-promise": "~4.2.1",5402 "eslint-plugin-react": "~7.14.2",5403 "eslint-plugin-standard": "~4.0.0",5404 "standard-engine": "^12.0.0"5405 },5406 "dependencies": {5407 "cli-cursor": {5408 "version": "2.1.0",5409 "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",5410 "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",5411 "dev": true,5412 "requires": {5413 "restore-cursor": "^2.0.0"5414 }5415 },5416 "eslint": {5417 "version": "6.4.0",5418 "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.4.0.tgz",5419 "integrity": "sha512-WTVEzK3lSFoXUovDHEbkJqCVPEPwbhCq4trDktNI6ygs7aO41d4cDT0JFAT5MivzZeVLWlg7vHL+bgrQv/t3vA==",5420 "dev": true,5421 "requires": {5422 "@babel/code-frame": "^7.0.0",5423 "ajv": "^6.10.0",5424 "chalk": "^2.1.0",5425 "cross-spawn": "^6.0.5",5426 "debug": "^4.0.1",5427 "doctrine": "^3.0.0",5428 "eslint-scope": "^5.0.0",5429 "eslint-utils": "^1.4.2",5430 "eslint-visitor-keys": "^1.1.0",5431 "espree": "^6.1.1",5432 "esquery": "^1.0.1",5433 "esutils": "^2.0.2",5434 "file-entry-cache": "^5.0.1",5435 "functional-red-black-tree": "^1.0.1",5436 "glob-parent": "^5.0.0",5437 "globals": "^11.7.0",5438 "ignore": "^4.0.6",5439 "import-fresh": "^3.0.0",5440 "imurmurhash": "^0.1.4",5441 "inquirer": "^6.4.1",5442 "is-glob": "^4.0.0",5443 "js-yaml": "^3.13.1",5444 "json-stable-stringify-without-jsonify": "^1.0.1",5445 "levn": "^0.3.0",5446 "lodash": "^4.17.14",5447 "minimatch": "^3.0.4",5448 "mkdirp": "^0.5.1",5449 "natural-compare": "^1.4.0",5450 "optionator": "^0.8.2",5451 "progress": "^2.0.0",5452 "regexpp": "^2.0.1",5453 "semver": "^6.1.2",5454 "strip-ansi": "^5.2.0",5455 "strip-json-comments": "^3.0.1",5456 "table": "^5.2.3",5457 "text-table": "^0.2.0",5458 "v8-compile-cache": "^2.0.3"5459 }5460 },5461 "figures": {5462 "version": "2.0.0",5463 "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",5464 "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",5465 "dev": true,5466 "requires": {5467 "escape-string-regexp": "^1.0.5"5468 }5469 },5470 "inquirer": {5471 "version": "6.5.2",5472 "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz",5473 "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==",5474 "dev": true,5475 "requires": {5476 "ansi-escapes": "^3.2.0",5477 "chalk": "^2.4.2",5478 "cli-cursor": "^2.1.0",5479 "cli-width": "^2.0.0",5480 "external-editor": "^3.0.3",5481 "figures": "^2.0.0",5482 "lodash": "^4.17.12",5483 "mute-stream": "0.0.7",5484 "run-async": "^2.2.0",5485 "rxjs": "^6.4.0",5486 "string-width": "^2.1.0",5487 "strip-ansi": "^5.1.0",5488 "through": "^2.3.6"5489 }5490 },5491 "mimic-fn": {5492 "version": "1.2.0",5493 "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",5494 "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",5495 "dev": true5496 },5497 "mute-stream": {5498 "version": "0.0.7",5499 "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",5500 "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",5501 "dev": true5502 },5503 "onetime": {5504 "version": "2.0.1",5505 "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",5506 "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",5507 "dev": true,5508 "requires": {5509 "mimic-fn": "^1.0.0"5510 }5511 },5512 "restore-cursor": {5513 "version": "2.0.0",5514 "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",5515 "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",5516 "dev": true,5517 "requires": {5518 "onetime": "^2.0.0",5519 "signal-exit": "^3.0.2"5520 }5521 },5522 "string-width": {5523 "version": "2.1.1",5524 "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",5525 "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",5526 "dev": true,5527 "requires": {5528 "is-fullwidth-code-point": "^2.0.0",5529 "strip-ansi": "^4.0.0"5530 },5531 "dependencies": {5532 "strip-ansi": {5533 "version": "4.0.0",5534 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",5535 "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",5536 "dev": true,5537 "requires": {5538 "ansi-regex": "^3.0.0"5539 }5540 }5541 }5542 }5543 }5544 },5545 "standard-engine": {5546 "version": "12.0.0",
63 unmodified lines
5610 }5611 }5612 },5613 "string-width": {5443 "version": "2.1.1",5444 "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",5445 "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",5614 "version": "4.2.0",5615 "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",5616 "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",5617 "dev": true,5618 "requires": {5619 "emoji-regex": "^8.0.0",5448 "is-fullwidth-code-point": "^2.0.0",5449 "strip-ansi": "^4.0.0"5620 "is-fullwidth-code-point": "^3.0.0",5621 "strip-ansi": "^6.0.0"5622 },5623 "dependencies": {5624 "ansi-regex": {5625 "version": "5.0.0",5626 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",5627 "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",5628 "dev": true5629 },5630 "emoji-regex": {5631 "version": "8.0.0",5632 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",5633 "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",5634 "dev": true5635 },5636 "is-fullwidth-code-point": {5637 "version": "3.0.0",5638 "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",5639 "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",5640 "dev": true5641 },5642 "strip-ansi": {5453 "version": "4.0.0",5454 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",5455 "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",5643 "version": "6.0.0",5644 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",5645 "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",5646 "dev": true,5647 "requires": {5458 "ansi-regex": "^3.0.0"5648 "ansi-regex": "^5.0.0"5649 }5650 }5651 }5652 },
203 unmodified lines
5856 "requires": {5857 "punycode": "^2.1.0"5858 }5859 },5670 "ts-node": {5671 "version": "8.4.1",5672 "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.4.1.tgz",5673 "integrity": "sha512-5LpRN+mTiCs7lI5EtbXmF/HfMeCjzt7DH9CZwtkr6SywStrNQC723wG+aOWFiLNn7zT3kD/RnFqi3ZUfr4l5Qw==",5674 "dev": true,5675 "requires": {5676 "arg": "^4.1.0",5677 "diff": "^4.0.1",5678 "make-error": "^1.1.1",5679 "source-map-support": "^0.5.6",5680 "yn": "^3.0.0"5681 }5682 },5860 "tslib": {5861 "version": "1.10.0",5862 "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",5863 "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
29 unmodified lines
5893 "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==",5894 "dev": true5895 },5896 "typescript": {5720 "version": "3.6.3",5721 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.3.tgz",5722 "integrity": "sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==",5897 "version": "3.7.2",5898 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.2.tgz",5899 "integrity": "sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==",5900 "dev": true5901 },5902 "uglify-js": {5726 "version": "3.6.0",5727 "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",5728 "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",5903 "version": "3.6.9",5904 "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.9.tgz",5905 "integrity": "sha512-pcnnhaoG6RtrvHJ1dFncAe8Od6Nuy30oaJ82ts6//sGSXOP5UjBMEthiProjXmMNHOfd93sqlkztifFMcb+4yw==",5906 "dev": true,5907 "optional": true,5908 "requires": {5732 "commander": "~2.20.0",5909 "commander": "~2.20.3",5910 "source-map": "~0.6.1"5911 }5912 },5913 "union-value": {
182 unmodified lines
6096 "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",6097 "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",6098 "dev": true6099 },6100 "word-wrap": {6101 "version": "1.2.3",6102 "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",6103 "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",6104 "dev": true6105 },6106 "wordwrap": {6107 "version": "1.0.0",6108 "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",6109 "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
115 unmodified lines
6225 "requires": {6226 "camelcase": "^5.0.0",6227 "decamelize": "^1.2.0"6228 }6046 },6047 "yn": {6048 "version": "3.1.1",6049 "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",6050 "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",6051 "dev": true6229 }6230 }6231}
modified:package.json+6 added-7 removed
1{2 "name": "commander",3 "version": "4.0.1",3 "version": "4.1.0",4 "description": "the complete solution for node.js command-line programs",5 "keywords": [6 "commander",7 "command",
17 unmodified lines
25 "typings/index.d.ts"26 ],27 "dependencies": {},28 "devDependencies": {29 "@types/jest": "^24.0.18",30 "@types/node": "^12.7.5",31 "eslint": "^6.4.0",32 "eslint-plugin-jest": "^22.17.0",29 "@types/jest": "^24.0.23",30 "@types/node": "^12.12.11",31 "eslint": "^6.7.0",32 "eslint-plugin-jest": "^22.21.0",33 "jest": "^24.8.0",34 "standard": "^14.3.1",35 "ts-node": "^8.4.1",36 "typescript": "^3.6.3"35 "typescript": "^3.7.2"36 },37 "typings": "typings/index.d.ts",38 "engines": {39 "node": ">= 6"
2 unmodified lines
modified:Readme_zh-CN.md+58 added-4 removed
29 unmodified lines
30 - [.helpOption(flags, description)](#helpoptionflags-description)31 - [.help(cb)](#helpcb)32 - [自定义事件监听](#%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6%e7%9b%91%e5%90%ac)33 - [零碎知识](#%e9%9b%b6%e7%a2%8e%e7%9f%a5%e8%af%86)34 - [避免选项命名冲突](#避免选项命名冲突)35 - [TypeScript](#typescript)35 - [Node 选项例如 `--harmony`](#node-%e9%80%89%e9%a1%b9%e4%be%8b%e5%a6%82---harmony)36 - [Node 选项例如 --harmony](#node-%e9%80%89%e9%a1%b9%e4%be%8b%e5%a6%82---harmony)37 - [Node 调试](#node-%e8%b0%83%e8%af%95)38 - [重载退出(exit)处理](#%e9%87%8d%e8%bd%bd%e9%80%80%e5%87%baexit%e5%a4%84%e7%90%86)39 - [例子](#%e4%be%8b%e5%ad%90)40 - [许可证](#%e8%ae%b8%e5%8f%af%e8%af%81)41 - [支持](#%e6%94%af%e6%8c%81)42 - [企业使用Commander](#企业使用Commander)4344## 安装4546```bash
22 unmodified lines
69`.option()` 方法用来定义带选项的 commander,同时也用于这些选项的文档。每个选项可以有一个短标识(单个字符)和一个长名字,它们之间用逗号或空格分开。7071 选项会被放到 Commander 对象的属性上,多词选项如"--template-engine"会被转为驼峰法`program.templateEngine`。多个短标识可以组合为一个参数,如`-a -b -c`等价于`-abc`。7273 另请参看可选的新功能 [避免命名冲突](#避免选项命名冲突).7475### 常用选项类型,boolean和值7677最常用的两个选项类型是boolean(选项后面不跟值)和选项跟一个值(使用尖括号声明)。除非在命令行中指定,否则两者都是`undefined`。78
292 unmodified lines
371372program.parse(process.argv)373```374375你可以自行实现一个`async`操作处理程序,同时调用`.parseAsync`代替`.parse`。376377```js378async function run() { /* 在这里编写代码 */ }379380async function main() {381 program382 .command('run')383 .action(run);384 await program.parseAsync(process.argv);385}386```387388389当一个命令在命令行上被使用时,它的选项必须是合法的。使用任何未知的选项会报错。然而如果一个基于操作的命令没有定义任何操作,那么这些选项是不合法的。390391定义配置选项可以随着调用 `.command()` 传递。392为 `opts.noHelp` 指定 `true` 则该命令不会出现生成的帮助输出里。
164 unmodified lines
557```558559## 零碎知识560561### 避免选项命名冲突562563Commander原本和默认的行为是将选项值作为program的属性存储的,并且给操作处理程序(action handler)传递了一个将选项值作为属性存储的command对象。564这样确实使得编程很方便,但是会带来有可能会和Command对象的属性相冲突的缺点。565566这里有两种方法来改变着这样的行为,而且我们有可能在将来改变默认的行为567568- `storeOptionsAsProperties`: 是否将选项值作为command对象的属性来存储,亦或者分开地存储(指定 false)并使用`.opts()`来获得。569- `passCommandToAction`: 是否把command对象传递给操作处理程序,亦或者仅仅传递这些选项(指定 false)570571```js572// 文件: ./examples/storeOptionsAsProperties.action.js573program574 .storeOptionsAsProperties(false)575 .passCommandToAction(false);576577program578 .name('my-program-name')579 .option('-n,--name <name>');580581program582 .command('show')583 .option('-a,--action <action>')584 .action((options) => {585 console.log(options.action);586 });587588program.parse(process.argv);589590const programOptions = program.opts();591console.log(programOptions.name);592```593594### TypeScript595596包里包含 TypeScript 定义文件,但是需要你自己安装 node types。如:597
88 unmodified lines
686[MIT](https://github.com/tj/commander.js/blob/master/LICENSE)687688## 支持689639Commander 现在在Node 8以及更高的版本上得到支持。(尽管Commander仍有可能在更低的Node版本上工作,但是Node 8以下版本不再保证相关的测试)690Commander 4.x版本现在在Node 8以及更高的版本上得到支持,尽管仍有可能在Node 6版本上工作,但是不再保证相关的测试。691(对于Node版本低于6的情况,建议使用Commander 3.x 或 2.x版本。)692693主要的社区支持的免费论坛就在Github上的项目[Issues](https://github.com/tj/commander.js/issues)694643[专业支持的commander现在已经可用!](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=readme)695### 企业使用Commander696645Tidelift为软件开发团队提供了购买和维护其软件的单一来源,并由最了解软件的专家提供专业级保证,同时与现有工具无缝集成。697作为Tidelift订阅的一部分现在可用698699Commander和数以千计的其他包的维护者在与Tidelift合作,提供对于企业用来构筑应用的开源依赖的商业支持与维护。通过向相关依赖包的维护者支付一定费用,从而帮助企业节省时间,降低风险,改进代码运行情况。[了解更多](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
modified:Readme.md+57 added-3 removed
9 unmodified lines
10Read this in other languages: English | [简体中文](./Readme_zh-CN.md)1112- [Commander.js](#commanderjs)13 - [Installation](#installation)14 - [Declaring _program_ variable](#declaring-program-variable)14 - [Declaring program variable](#declaring-program-variable)15 - [Options](#options)16 - [Common option types, boolean and value](#common-option-types-boolean-and-value)17 - [Default option value](#default-option-value)18 - [Other option types, negatable boolean and flag|value](#other-option-types-negatable-boolean-and-flagvalue)
11 unmodified lines
30 - [.helpOption(flags, description)](#helpoptionflags-description)31 - [.help(cb)](#helpcb)32 - [Custom event listeners](#custom-event-listeners)33 - [Bits and pieces](#bits-and-pieces)34 - [Avoiding option name clashes](#avoiding-option-name-clashes)35 - [TypeScript](#typescript)35 - [Node options such as `--harmony`](#node-options-such-as---harmony)36 - [Node options such as --harmony](#node-options-such-as---harmony)37 - [Node debugging](#node-debugging)38 - [Override exit handling](#override-exit-handling)39 - [Examples](#examples)40 - [License](#license)
29 unmodified lines
70Options are defined with the `.option()` method, also serving as documentation for the options. Each option can have a short flag (single character) and a long name, separated by a comma or space.7172The options can be accessed as properties on the Command object. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. Multiple short flags may be combined as a single arg, for example `-abc` is equivalent to `-a -b -c`.7374See also optional new behaviour to [avoid name clashes](#avoiding-option-name-clashes).7576### Common option types, boolean and value7778The two most used option types are a boolean flag, and an option which takes a value (declared using angle brackets). Both are `undefined` unless specified on command line.79
296 unmodified lines
376377program.parse(process.argv)378```379380You may supply an `async` action handler, in which case you call `.parseAsync` rather than `.parse`.381382```js383async function run() { /* code goes here */ }384385async function main() {386 program387 .command('run')388 .action(run);389 await program.parseAsync(process.argv);390}391```392393A command's options on the command line 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.394395Configuration options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the command from the generated help output.396
168 unmodified lines
565```566567## Bits and pieces568569### Avoiding option name clashes570571The original and default behaviour is that the option values are stored572as properties on the program, and the action handler is passed a573command object with the options values stored as properties.574This is very convenient to code, but the downside is possible clashes with575existing properties of Command.576577There are two new routines to change the behaviour, and the default behaviour may change in the future:578579- `storeOptionsAsProperties`: whether to store option values as properties on command object, or store separately (specify false) and access using `.opts()`580- `passCommandToAction`: whether to pass command to action handler,581or just the options (specify false)582583```js584// file: ./examples/storeOptionsAsProperties.action.js585program586 .storeOptionsAsProperties(false)587 .passCommandToAction(false);588589program590 .name('my-program-name')591 .option('-n,--name <name>');592593program594 .command('show')595 .option('-a,--action <action>')596 .action((options) => {597 console.log(options.action);598 });599600program.parse(process.argv);601602const programOptions = program.opts();603console.log(programOptions.name);604```605606### TypeScript607608The Commander package includes its TypeScript Definition file, but also requires the node types which you need to install yourself. e.g.609
90 unmodified lines
700[MIT](https://github.com/tj/commander.js/blob/master/LICENSE)701702## Support703651Commander is supported on Node 8 and above. (Commander is likely to still work on older versions of Node, but is not tested below Node 8.)704Commander 4.x is supported on Node 8 and above, and is likely to work with Node 6 but not tested.705(For versions of Node below Node 6, use Commander 3.x or 2.x.)706707The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub.708709### Commander for enterprise
4 unmodified lines
modified:SECURITY.md+8 added-5 removed
1# Security Policy23## Supported Versions45| Version | Supported |6| ------- | ------------------ |7| 4.x | :white_check_mark: |8| 3.x | :white_check_mark: |9| < 3 | :x: |5Old versions receive security updates for six months.67| Version | Supported |8| ------- | ------------------------------------------ |9| 4.x | :white_check_mark: |10| 3.x | :white_check_mark: support ends 2020-05-01 |11| 2.x | :white_check_mark: support ends 2020-02-03 |12| < 2 | :x: |1314## Reporting a Vulnerability1516To report a security vulnerability, please use the17[Tidelift security contact](https://tidelift.com/security).
1 unmodified line