LINXD-1029: Add relative path to simulator
This commit is contained in:
889
node_modules/yargs/CHANGELOG.md
generated
vendored
889
node_modules/yargs/CHANGELOG.md
generated
vendored
@ -1,4 +1,889 @@
|
||||
## Change Log
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [14.2.0](https://github.com/yargs/yargs/compare/v14.1.0...v14.2.0) (2019-10-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* async middleware was called twice ([#1422](https://github.com/yargs/yargs/issues/1422)) ([9a42b63](https://github.com/yargs/yargs/commit/9a42b63))
|
||||
* fix promise check to accept any spec conform object ([#1424](https://github.com/yargs/yargs/issues/1424)) ([0be43d2](https://github.com/yargs/yargs/commit/0be43d2))
|
||||
* groups were not being maintained for nested commands ([#1430](https://github.com/yargs/yargs/issues/1430)) ([d38650e](https://github.com/yargs/yargs/commit/d38650e))
|
||||
* **docs:** broken markdown link ([#1426](https://github.com/yargs/yargs/issues/1426)) ([236e24e](https://github.com/yargs/yargs/commit/236e24e))
|
||||
* support merging deeply nested configuration ([#1423](https://github.com/yargs/yargs/issues/1423)) ([bae66fe](https://github.com/yargs/yargs/commit/bae66fe))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **deps:** introduce yargs-parser with support for unknown-options-as-args ([#1440](https://github.com/yargs/yargs/issues/1440)) ([4d21520](https://github.com/yargs/yargs/commit/4d21520))
|
||||
|
||||
## [14.1.0](https://github.com/yargs/yargs/compare/v14.0.0...v14.1.0) (2019-09-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **docs:** fix incorrect parserConfiguration documentation ([2a99124](https://github.com/yargs/yargs/commit/2a99124))
|
||||
* detect zsh when zsh isnt run as a login prompt ([#1395](https://github.com/yargs/yargs/issues/1395)) ([8792d13](https://github.com/yargs/yargs/commit/8792d13))
|
||||
* populate correct value on yargs.parsed and stop warning on access ([#1412](https://github.com/yargs/yargs/issues/1412)) ([bb0eb52](https://github.com/yargs/yargs/commit/bb0eb52))
|
||||
* showCompletionScript was logging script twice ([#1388](https://github.com/yargs/yargs/issues/1388)) ([07c8537](https://github.com/yargs/yargs/commit/07c8537))
|
||||
* strict() should not ignore hyphenated arguments ([#1414](https://github.com/yargs/yargs/issues/1414)) ([b774b5e](https://github.com/yargs/yargs/commit/b774b5e))
|
||||
* **docs:** formalize existing callback argument to showHelp ([#1386](https://github.com/yargs/yargs/issues/1386)) ([d217764](https://github.com/yargs/yargs/commit/d217764))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* make it possible to merge configurations when extending other config. ([#1411](https://github.com/yargs/yargs/issues/1411)) ([5d7ad98](https://github.com/yargs/yargs/commit/5d7ad98))
|
||||
|
||||
## [14.0.0](https://github.com/yargs/yargs/compare/v13.3.0...v14.0.0) (2019-07-30)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* we now only officially support yargs.$0 parameter and discourage direct access to yargs.parsed
|
||||
* previously to this fix methods like `yargs.getOptions()` contained the state of the last command to execute.
|
||||
* do not allow additional positionals in strict mode
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* calling parse multiple times now appropriately maintains state ([#1137](https://github.com/yargs/yargs/issues/1137)) ([#1369](https://github.com/yargs/yargs/issues/1369)) ([026b151](https://github.com/yargs/yargs/commit/026b151))
|
||||
* prefer user supplied script name in usage ([#1383](https://github.com/yargs/yargs/issues/1383)) ([28c74b9](https://github.com/yargs/yargs/commit/28c74b9))
|
||||
* **deps:** use decamelize from npm instead of vendored copy ([#1377](https://github.com/yargs/yargs/issues/1377)) ([015eeb9](https://github.com/yargs/yargs/commit/015eeb9))
|
||||
* **examples:** fix usage-options.js to reflect current API ([#1375](https://github.com/yargs/yargs/issues/1375)) ([6e5b76b](https://github.com/yargs/yargs/commit/6e5b76b))
|
||||
* do not allow additional positionals in strict mode ([35d777c](https://github.com/yargs/yargs/commit/35d777c))
|
||||
* properties accessed on singleton now reflect current state of instance ([#1366](https://github.com/yargs/yargs/issues/1366)) ([409d35b](https://github.com/yargs/yargs/commit/409d35b))
|
||||
* tolerate null prototype for config objects with `extends` ([#1376](https://github.com/yargs/yargs/issues/1376)) ([3d26d11](https://github.com/yargs/yargs/commit/3d26d11)), closes [#1372](https://github.com/yargs/yargs/issues/1372)
|
||||
* yargs.parsed now populated before returning, when yargs.parse() called with no args (#1382) ([e3981fd](https://github.com/yargs/yargs/commit/e3981fd)), closes [#1382](https://github.com/yargs/yargs/issues/1382)
|
||||
|
||||
### Features
|
||||
|
||||
* adds support for multiple epilog messages ([#1384](https://github.com/yargs/yargs/issues/1384)) ([07a5554](https://github.com/yargs/yargs/commit/07a5554))
|
||||
* allow completionCommand to be set via showCompletionScript ([#1385](https://github.com/yargs/yargs/issues/1385)) ([5562853](https://github.com/yargs/yargs/commit/5562853))
|
||||
|
||||
## [13.3.0](https://www.github.com/yargs/yargs/compare/v13.2.4...v13.3.0) (2019-06-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** yargs-parser update addressing several parsing bugs ([#1357](https://www.github.com/yargs/yargs/issues/1357)) ([e230d5b](https://www.github.com/yargs/yargs/commit/e230d5b))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **i18n:** swap out os-locale dependency for simple inline implementation ([#1356](https://www.github.com/yargs/yargs/issues/1356)) ([4dfa19b](https://www.github.com/yargs/yargs/commit/4dfa19b))
|
||||
* support defaultDescription for positional arguments ([812048c](https://www.github.com/yargs/yargs/commit/812048c))
|
||||
|
||||
### [13.2.4](https://github.com/yargs/yargs/compare/v13.2.3...v13.2.4) (2019-05-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **i18n:** rename unclear 'implication failed' to 'missing dependent arguments' ([#1317](https://github.com/yargs/yargs/issues/1317)) ([bf46813](https://github.com/yargs/yargs/commit/bf46813))
|
||||
|
||||
|
||||
|
||||
### [13.2.3](https://github.com/yargs/yargs/compare/v13.2.2...v13.2.3) (2019-05-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** upgrade cliui for compatibility with latest chalk. ([#1330](https://github.com/yargs/yargs/issues/1330)) ([b20db65](https://github.com/yargs/yargs/commit/b20db65))
|
||||
* address issues with dutch translation ([#1316](https://github.com/yargs/yargs/issues/1316)) ([0295132](https://github.com/yargs/yargs/commit/0295132))
|
||||
|
||||
|
||||
### Tests
|
||||
|
||||
* accept differently formatted output ([#1327](https://github.com/yargs/yargs/issues/1327)) ([c294d1b](https://github.com/yargs/yargs/commit/c294d1b))
|
||||
|
||||
|
||||
|
||||
## [13.2.2](https://github.com/yargs/yargs/compare/v13.2.1...v13.2.2) (2019-03-06)
|
||||
|
||||
|
||||
|
||||
## [13.2.1](https://github.com/yargs/yargs/compare/v13.2.0...v13.2.1) (2019-02-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add zsh script to files array ([3180224](https://github.com/yargs/yargs/commit/3180224))
|
||||
* support options/sub-commands in zsh completion ([0a96394](https://github.com/yargs/yargs/commit/0a96394))
|
||||
|
||||
|
||||
# [13.2.0](https://github.com/yargs/yargs/compare/v13.1.0...v13.2.0) (2019-02-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* zsh auto completion ([#1292](https://github.com/yargs/yargs/issues/1292)) ([16c5d25](https://github.com/yargs/yargs/commit/16c5d25)), closes [#1156](https://github.com/yargs/yargs/issues/1156)
|
||||
|
||||
|
||||
<a name="13.1.0"></a>
|
||||
# [13.1.0](https://github.com/yargs/yargs/compare/v13.0.0...v13.1.0) (2019-02-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add applyBeforeValidation, for applying sync middleware before validation ([5be206a](https://github.com/yargs/yargs/commit/5be206a))
|
||||
|
||||
|
||||
|
||||
<a name="13.0.0"></a>
|
||||
# [13.0.0](https://github.com/yargs/yargs/compare/v12.0.5...v13.0.0) (2019-02-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** Update os-locale to avoid security vulnerability ([#1270](https://github.com/yargs/yargs/issues/1270)) ([27bf739](https://github.com/yargs/yargs/commit/27bf739))
|
||||
* **validation:** Use the error as a message when none exists otherwise ([#1268](https://github.com/yargs/yargs/issues/1268)) ([0510fe6](https://github.com/yargs/yargs/commit/0510fe6))
|
||||
* better bash path completion ([#1272](https://github.com/yargs/yargs/issues/1272)) ([da75ea2](https://github.com/yargs/yargs/commit/da75ea2))
|
||||
* middleware added multiple times due to reference bug ([#1282](https://github.com/yargs/yargs/issues/1282)) ([64af518](https://github.com/yargs/yargs/commit/64af518))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* ~drop Node 6 from testing matrix ([#1287](https://github.com/yargs/yargs/issues/1287)) ([ef16792](https://github.com/yargs/yargs/commit/ef16792))~
|
||||
* _opting to not drop Node 6 support until April, [see](https://github.com/nodejs/Release)._
|
||||
* update dependencies ([#1284](https://github.com/yargs/yargs/issues/1284)) ([f25de4f](https://github.com/yargs/yargs/commit/f25de4f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add `.parserConfiguration()` method, deprecating package.json config ([#1262](https://github.com/yargs/yargs/issues/1262)) ([3c6869a](https://github.com/yargs/yargs/commit/3c6869a))
|
||||
* adds config option for sorting command output ([#1256](https://github.com/yargs/yargs/issues/1256)) ([6916ce9](https://github.com/yargs/yargs/commit/6916ce9))
|
||||
* options/positionals with leading '+' and '0' no longer parse as numbers ([#1286](https://github.com/yargs/yargs/issues/1286)) ([e9dc3aa](https://github.com/yargs/yargs/commit/e9dc3aa))
|
||||
* support promises in middleware ([f3a4e4f](https://github.com/yargs/yargs/commit/f3a4e4f))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* options with leading '+' or '0' now parse as strings
|
||||
* dropping Node 6 which hits end of life in April 2019
|
||||
* see [yargs-parser@12.0.0 CHANGELOG](https://github.com/yargs/yargs-parser/blob/master/CHANGELOG.md#breaking-changes)
|
||||
* we now warn if the yargs stanza package.json is used.
|
||||
|
||||
|
||||
|
||||
<a name="12.0.5"></a>
|
||||
## [12.0.5](https://github.com/yargs/yargs/compare/v12.0.4...v12.0.5) (2018-11-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allows camel-case, variadic arguments, and strict mode to be combined ([#1247](https://github.com/yargs/yargs/issues/1247)) ([eacc035](https://github.com/yargs/yargs/commit/eacc035))
|
||||
|
||||
|
||||
|
||||
<a name="12.0.4"></a>
|
||||
## [12.0.4](https://github.com/yargs/yargs/compare/v12.0.3...v12.0.4) (2018-11-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't load config when processing positionals ([5d0dc92](https://github.com/yargs/yargs/commit/5d0dc92))
|
||||
|
||||
|
||||
|
||||
<a name="12.0.3"></a>
|
||||
## [12.0.3](https://github.com/yargs/yargs/compare/v12.0.2...v12.0.3) (2018-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* $0 contains first arg in bundled electron apps ([#1206](https://github.com/yargs/yargs/issues/1206)) ([567820b](https://github.com/yargs/yargs/commit/567820b))
|
||||
* accept single function for middleware ([66fd6f7](https://github.com/yargs/yargs/commit/66fd6f7)), closes [#1214](https://github.com/yargs/yargs/issues/1214) [#1214](https://github.com/yargs/yargs/issues/1214)
|
||||
* hide `hidden` options from help output even if they are in a group ([#1221](https://github.com/yargs/yargs/issues/1221)) ([da54028](https://github.com/yargs/yargs/commit/da54028))
|
||||
* improve Norwegian Bokmål translations ([#1208](https://github.com/yargs/yargs/issues/1208)) ([a458fa4](https://github.com/yargs/yargs/commit/a458fa4))
|
||||
* improve Norwegian Nynorsk translations ([#1207](https://github.com/yargs/yargs/issues/1207)) ([d422eb5](https://github.com/yargs/yargs/commit/d422eb5))
|
||||
|
||||
|
||||
|
||||
<a name="12.0.2"></a>
|
||||
## [12.0.2](https://github.com/yargs/yargs/compare/v12.0.1...v12.0.2) (2018-09-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* middleware should work regardless of when method is called ([664b265](https://github.com/yargs/yargs/commit/664b265)), closes [#1178](https://github.com/yargs/yargs/issues/1178)
|
||||
* translation not working when using __ with a single parameter ([#1183](https://github.com/yargs/yargs/issues/1183)) ([f449aea](https://github.com/yargs/yargs/commit/f449aea))
|
||||
* upgrade os-locale to version that addresses license issue ([#1195](https://github.com/yargs/yargs/issues/1195)) ([efc0970](https://github.com/yargs/yargs/commit/efc0970))
|
||||
|
||||
|
||||
|
||||
<a name="12.0.1"></a>
|
||||
## [12.0.1](https://github.com/yargs/yargs/compare/v12.0.0...v12.0.1) (2018-06-29)
|
||||
|
||||
|
||||
|
||||
<a name="12.0.0"></a>
|
||||
# [12.0.0](https://github.com/yargs/yargs/compare/v11.1.0...v12.0.0) (2018-06-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* .argv and .parse() now invoke identical code path ([#1126](https://github.com/yargs/yargs/issues/1126)) ([f13ebf4](https://github.com/yargs/yargs/commit/f13ebf4))
|
||||
* remove the trailing white spaces from the help output ([#1090](https://github.com/yargs/yargs/issues/1090)) ([3f0746c](https://github.com/yargs/yargs/commit/3f0746c))
|
||||
* **completion:** Avoid default command and recommendations during completion ([#1123](https://github.com/yargs/yargs/issues/1123)) ([036e7c5](https://github.com/yargs/yargs/commit/036e7c5))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* test Node.js 6, 8 and 10 ([#1160](https://github.com/yargs/yargs/issues/1160)) ([84f9d2b](https://github.com/yargs/yargs/commit/84f9d2b))
|
||||
* upgrade to version of yargs-parser that does not populate value for unset boolean ([#1104](https://github.com/yargs/yargs/issues/1104)) ([d4705f4](https://github.com/yargs/yargs/commit/d4705f4))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for global middleware, useful for shared tasks like metrics ([#1119](https://github.com/yargs/yargs/issues/1119)) ([9d71ac7](https://github.com/yargs/yargs/commit/9d71ac7))
|
||||
* allow setting scriptName $0 ([#1143](https://github.com/yargs/yargs/issues/1143)) ([a2f2eae](https://github.com/yargs/yargs/commit/a2f2eae))
|
||||
* remove `setPlaceholderKeys` ([#1105](https://github.com/yargs/yargs/issues/1105)) ([6ee2c82](https://github.com/yargs/yargs/commit/6ee2c82))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Options absent from `argv` (not set via CLI argument) are now absent from the parsed result object rather than being set with `undefined`
|
||||
* drop Node 4 from testing matrix, such that we'll gradually start drifting away from supporting Node 4.
|
||||
* yargs-parser does not populate 'false' when boolean flag is not passed
|
||||
* tests that assert against help output will need to be updated
|
||||
|
||||
|
||||
|
||||
<a name="11.1.0"></a>
|
||||
# [11.1.0](https://github.com/yargs/yargs/compare/v11.0.0...v11.1.0) (2018-03-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* choose correct config directory when require.main does not exist ([#1056](https://github.com/yargs/yargs/issues/1056)) ([a04678c](https://github.com/yargs/yargs/commit/a04678c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow hidden options to be displayed with --show-hidden ([#1061](https://github.com/yargs/yargs/issues/1061)) ([ea862ae](https://github.com/yargs/yargs/commit/ea862ae))
|
||||
* extend *.rc files in addition to json ([#1080](https://github.com/yargs/yargs/issues/1080)) ([11691a6](https://github.com/yargs/yargs/commit/11691a6))
|
||||
|
||||
|
||||
|
||||
<a name="11.0.0"></a>
|
||||
# [11.0.0](https://github.com/yargs/yargs/compare/v10.1.2...v11.0.0) (2018-01-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Set implicit nargs=1 when type=number requiresArg=true ([#1050](https://github.com/yargs/yargs/issues/1050)) ([2b56812](https://github.com/yargs/yargs/commit/2b56812))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* requiresArg is now simply an alias for nargs(1) ([#1054](https://github.com/yargs/yargs/issues/1054)) ([a3ddacc](https://github.com/yargs/yargs/commit/a3ddacc))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* requiresArg now has significantly different error output, matching nargs.
|
||||
|
||||
|
||||
|
||||
<a name="10.1.2"></a>
|
||||
## [10.1.2](https://github.com/yargs/yargs/compare/v10.1.1...v10.1.2) (2018-01-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* requiresArg should only be enforced if argument exists ([#1043](https://github.com/yargs/yargs/issues/1043)) ([fbf41ae](https://github.com/yargs/yargs/commit/fbf41ae))
|
||||
|
||||
|
||||
|
||||
<a name="10.1.1"></a>
|
||||
## [10.1.1](https://github.com/yargs/yargs/compare/v10.1.0...v10.1.1) (2018-01-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add `dirname` sanity check on `findUp` ([#1036](https://github.com/yargs/yargs/issues/1036)) ([331d103](https://github.com/yargs/yargs/commit/331d103))
|
||||
|
||||
|
||||
|
||||
<a name="10.1.0"></a>
|
||||
# [10.1.0](https://github.com/yargs/yargs/compare/v10.0.3...v10.1.0) (2018-01-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 'undefined' should be taken to mean no argument was provided ([#1015](https://github.com/yargs/yargs/issues/1015)) ([c679e90](https://github.com/yargs/yargs/commit/c679e90))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add missing simple chinese locale strings ([#1004](https://github.com/yargs/yargs/issues/1004)) ([3cc24ec](https://github.com/yargs/yargs/commit/3cc24ec))
|
||||
* add Norwegian Nynorsk translations ([#1028](https://github.com/yargs/yargs/issues/1028)) ([a5ac213](https://github.com/yargs/yargs/commit/a5ac213))
|
||||
* async command handlers ([#1001](https://github.com/yargs/yargs/issues/1001)) ([241124b](https://github.com/yargs/yargs/commit/241124b))
|
||||
* middleware ([#881](https://github.com/yargs/yargs/issues/881)) ([77b8dbc](https://github.com/yargs/yargs/commit/77b8dbc))
|
||||
|
||||
|
||||
|
||||
<a name="10.0.3"></a>
|
||||
## [10.0.3](https://github.com/yargs/yargs/compare/v10.0.2...v10.0.3) (2017-10-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* parse array rather than string, so that quotes are safe ([#993](https://github.com/yargs/yargs/issues/993)) ([c351685](https://github.com/yargs/yargs/commit/c351685))
|
||||
|
||||
|
||||
|
||||
<a name="10.0.2"></a>
|
||||
## [10.0.2](https://github.com/yargs/yargs/compare/v10.0.1...v10.0.2) (2017-10-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix tiny spacing issue with usage ([#992](https://github.com/yargs/yargs/issues/992)) ([7871327](https://github.com/yargs/yargs/commit/7871327))
|
||||
|
||||
|
||||
|
||||
<a name="10.0.1"></a>
|
||||
## [10.0.1](https://github.com/yargs/yargs/compare/v10.0.0...v10.0.1) (2017-10-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* help strings for nested commands were missing parent commands ([#990](https://github.com/yargs/yargs/issues/990)) ([cd1ca15](https://github.com/yargs/yargs/commit/cd1ca15))
|
||||
* use correct completion command in generated completion script ([#988](https://github.com/yargs/yargs/issues/988)) ([3c8ac1d](https://github.com/yargs/yargs/commit/3c8ac1d))
|
||||
|
||||
|
||||
|
||||
<a name="10.0.0"></a>
|
||||
# [10.0.0](https://github.com/yargs/yargs/compare/v9.1.0...v10.0.0) (2017-10-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* config and normalize can be disabled with false ([#952](https://github.com/yargs/yargs/issues/952)) ([3bb8771](https://github.com/yargs/yargs/commit/3bb8771))
|
||||
* less eager help command execution ([#972](https://github.com/yargs/yargs/issues/972)) ([8c1d7bf](https://github.com/yargs/yargs/commit/8c1d7bf))
|
||||
* the positional argument parse was clobbering global flag arguments ([#984](https://github.com/yargs/yargs/issues/984)) ([7e58453](https://github.com/yargs/yargs/commit/7e58453))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* .usage() can now be used to configure a default command ([#975](https://github.com/yargs/yargs/issues/975)) ([7269531](https://github.com/yargs/yargs/commit/7269531))
|
||||
* hidden options are now explicitly indicated using "hidden" flag ([#962](https://github.com/yargs/yargs/issues/962)) ([280d0d6](https://github.com/yargs/yargs/commit/280d0d6))
|
||||
* introduce .positional() for configuring positional arguments ([#967](https://github.com/yargs/yargs/issues/967)) ([cb16460](https://github.com/yargs/yargs/commit/cb16460))
|
||||
* replace $0 with file basename ([#983](https://github.com/yargs/yargs/issues/983)) ([20bb99b](https://github.com/yargs/yargs/commit/20bb99b))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* .usage() no longer accepts an options object as the second argument. It can instead be used as an alias for configuring a default command.
|
||||
* previously hidden options were simply implied using a falsy description
|
||||
* help command now only executes if it's the last positional in argv._
|
||||
|
||||
|
||||
|
||||
<a name="9.1.0"></a>
|
||||
# [9.1.0](https://github.com/yargs/yargs/compare/v9.0.1...v9.1.0) (2017-09-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **command:** Run default cmd even if the only cmd ([#950](https://github.com/yargs/yargs/issues/950)) ([7b22203](https://github.com/yargs/yargs/commit/7b22203))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* multiple usage calls are now collected, not replaced ([#958](https://github.com/yargs/yargs/issues/958)) ([74a38b2](https://github.com/yargs/yargs/commit/74a38b2))
|
||||
|
||||
|
||||
|
||||
<a name="9.0.1"></a>
|
||||
## [9.0.1](https://github.com/yargs/yargs/compare/v9.0.0...v9.0.1) (2017-09-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* implications fails only displayed once ([#954](https://github.com/yargs/yargs/issues/954)) ([ac8088b](https://github.com/yargs/yargs/commit/ac8088b))
|
||||
|
||||
|
||||
|
||||
<a name="9.0.0"></a>
|
||||
# [9.0.0](https://github.com/yargs/yargs/compare/v8.0.2...v9.0.0) (2017-09-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 'undefined' default value for choices resulted in validation failing ([782b896](https://github.com/yargs/yargs/commit/782b896))
|
||||
* address bug with handling of arrays of implications ([c240661](https://github.com/yargs/yargs/commit/c240661))
|
||||
* defaulting keys to 'undefined' interfered with conflicting key logic ([a8e0cff](https://github.com/yargs/yargs/commit/a8e0cff))
|
||||
* don't bother calling JSON.stringify() on string default values ([#891](https://github.com/yargs/yargs/issues/891)) ([628be21](https://github.com/yargs/yargs/commit/628be21))
|
||||
* exclude positional arguments from completion output ([#927](https://github.com/yargs/yargs/issues/927)) ([71c7ec7](https://github.com/yargs/yargs/commit/71c7ec7))
|
||||
* strict mode should not fail for hidden options ([#949](https://github.com/yargs/yargs/issues/949)) ([0e0c58d](https://github.com/yargs/yargs/commit/0e0c58d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow implies and conflicts to accept array values ([#922](https://github.com/yargs/yargs/issues/922)) ([abdc7da](https://github.com/yargs/yargs/commit/abdc7da))
|
||||
* allow parse with no arguments as alias for yargs.argv ([#944](https://github.com/yargs/yargs/issues/944)) ([a9f03e7](https://github.com/yargs/yargs/commit/a9f03e7))
|
||||
* enable .help() and .version() by default ([#912](https://github.com/yargs/yargs/issues/912)) ([1ef44e0](https://github.com/yargs/yargs/commit/1ef44e0))
|
||||
* to allow both undefined and nulls, for benefit of TypeScript ([#945](https://github.com/yargs/yargs/issues/945)) ([792564d](https://github.com/yargs/yargs/commit/792564d))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* version() and help() are now enabled by default, and show up in help output; the implicit help command can no longer be enabled/disabled independently from the help command itself (which can now be disabled).
|
||||
* parse() now behaves as an alias for .argv, unless a parseCallback is provided.
|
||||
|
||||
|
||||
|
||||
<a name="8.0.2"></a>
|
||||
## [8.0.2](https://github.com/yargs/yargs/compare/v8.0.1...v8.0.2) (2017-06-12)
|
||||
|
||||
|
||||
|
||||
<a name="8.0.1"></a>
|
||||
## [8.0.1](https://github.com/yargs/yargs/compare/v8.0.0...v8.0.1) (2017-05-02)
|
||||
|
||||
|
||||
|
||||
<a name="8.0.0"></a>
|
||||
# [8.0.0](https://github.com/yargs/yargs/compare/v7.1.0...v8.0.0) (2017-05-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* commands are now applied in order, from left to right ([#857](https://github.com/yargs/yargs/issues/857)) ([baba863](https://github.com/yargs/yargs/commit/baba863))
|
||||
* help now takes precedence over command recommendation ([#866](https://github.com/yargs/yargs/issues/866)) ([17e3567](https://github.com/yargs/yargs/commit/17e3567))
|
||||
* positional arguments now work if no handler is provided to inner command ([#864](https://github.com/yargs/yargs/issues/864)) ([e28ded3](https://github.com/yargs/yargs/commit/e28ded3))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* upgrade yargs-parser ([#867](https://github.com/yargs/yargs/issues/867)) ([8f9c6c6](https://github.com/yargs/yargs/commit/8f9c6c6))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow extends to inherit from a module ([#865](https://github.com/yargs/yargs/issues/865)) ([89456d9](https://github.com/yargs/yargs/commit/89456d9))
|
||||
* allow strict mode to be disabled ([#840](https://github.com/yargs/yargs/issues/840)) ([6f78c05](https://github.com/yargs/yargs/commit/6f78c05))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* extends functionality now always loads the JSON provided, rather than reading from a specific key
|
||||
* Node 4+ is now required; this will allow us to start updating our dependencies.
|
||||
* the first argument to strict() is now used to enable/disable its functionality, rather than controlling whether or not it is global.
|
||||
|
||||
|
||||
|
||||
<a name="7.1.0"></a>
|
||||
# [7.1.0](https://github.com/yargs/yargs/compare/v7.0.2...v7.1.0) (2017-04-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix demandOption no longer treats 'false' as truthy ([#829](https://github.com/yargs/yargs/issues/829)) ([c748dd2](https://github.com/yargs/yargs/commit/c748dd2))
|
||||
* get terminalWidth in non interactive mode no longer causes a validation exception ([#837](https://github.com/yargs/yargs/issues/837)) ([360e301](https://github.com/yargs/yargs/commit/360e301))
|
||||
* we shouldn't output help if we've printed a prior help-like message ([#847](https://github.com/yargs/yargs/issues/847)) ([17e89bd](https://github.com/yargs/yargs/commit/17e89bd))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for numeric commands ([#825](https://github.com/yargs/yargs/issues/825)) ([fde0564](https://github.com/yargs/yargs/commit/fde0564))
|
||||
|
||||
|
||||
|
||||
<a name="7.0.2"></a>
|
||||
## [7.0.2](https://github.com/yargs/yargs/compare/v7.0.1...v7.0.2) (2017-03-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* populating placeholder arguments broke validation ([b3eb2fe](https://github.com/yargs/yargs/commit/b3eb2fe))
|
||||
|
||||
|
||||
|
||||
<a name="7.0.1"></a>
|
||||
## [7.0.1](https://github.com/yargs/yargs/compare/v7.0.0...v7.0.1) (2017-03-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* --help with default command should print top-level help ([#810](https://github.com/yargs/yargs/issues/810)) ([9c03fa4](https://github.com/yargs/yargs/commit/9c03fa4))
|
||||
|
||||
|
||||
|
||||
<a name="7.0.0"></a>
|
||||
# [7.0.0](https://github.com/yargs/yargs/compare/v6.6.0...v7.0.0) (2017-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* address min/max validation message regression ([#750](https://github.com/yargs/yargs/issues/750)) ([2e5ce0f](https://github.com/yargs/yargs/commit/2e5ce0f))
|
||||
* address positional argument strict() bug introduced in [#766](https://github.com/yargs/yargs/issues/766) ([#784](https://github.com/yargs/yargs/issues/784)) ([a8528e6](https://github.com/yargs/yargs/commit/a8528e6))
|
||||
* console.warn() rather than throwing errors when api signatures are incorrect ([#804](https://github.com/yargs/yargs/issues/804)) ([a607061](https://github.com/yargs/yargs/commit/a607061))
|
||||
* context should override parsed argv ([#786](https://github.com/yargs/yargs/issues/786)) ([0997288](https://github.com/yargs/yargs/commit/0997288))
|
||||
* context variables are now recognized in strict() mode ([#796](https://github.com/yargs/yargs/issues/796)) ([48575cd](https://github.com/yargs/yargs/commit/48575cd))
|
||||
* errors were not bubbling appropriately from sub-commands to top-level ([#802](https://github.com/yargs/yargs/issues/802)) ([8a992f5](https://github.com/yargs/yargs/commit/8a992f5))
|
||||
* positional arguments of sub-commands threw strict() exception ([#805](https://github.com/yargs/yargs/issues/805)) ([f3f074b](https://github.com/yargs/yargs/commit/f3f074b))
|
||||
* pull in yargs-parser with modified env precedence ([#787](https://github.com/yargs/yargs/issues/787)) ([e0fbbe5](https://github.com/yargs/yargs/commit/e0fbbe5))
|
||||
* running parse() multiple times on the same yargs instance caused exception if help() enabled ([#790](https://github.com/yargs/yargs/issues/790)) ([07e39b7](https://github.com/yargs/yargs/commit/07e39b7))
|
||||
* use path.resolve() to support node 0.10 ([#797](https://github.com/yargs/yargs/issues/797)) ([49a93fc](https://github.com/yargs/yargs/commit/49a93fc))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add conflicts and implies shorthands. ([#753](https://github.com/yargs/yargs/issues/753)) ([bd1472b](https://github.com/yargs/yargs/commit/bd1472b))
|
||||
* add traditional Chinese translation ([#780](https://github.com/yargs/yargs/issues/780)) ([6ab6a95](https://github.com/yargs/yargs/commit/6ab6a95))
|
||||
* allow provided config object to extend other configs ([#779](https://github.com/yargs/yargs/issues/779)) ([3280dd0](https://github.com/yargs/yargs/commit/3280dd0))
|
||||
* function argument validation ([#773](https://github.com/yargs/yargs/issues/773)) ([22ed9bb](https://github.com/yargs/yargs/commit/22ed9bb))
|
||||
* if only one column is provided for examples, allow it to take up the entire line ([#749](https://github.com/yargs/yargs/issues/749)) ([7931652](https://github.com/yargs/yargs/commit/7931652))
|
||||
* introduce custom yargs error object ([#765](https://github.com/yargs/yargs/issues/765)) ([8308efa](https://github.com/yargs/yargs/commit/8308efa))
|
||||
* introduces support for default commands, using the '*' identifier ([#785](https://github.com/yargs/yargs/issues/785)) ([d78a0f5](https://github.com/yargs/yargs/commit/d78a0f5))
|
||||
* rethink how options are inherited by commands ([#766](https://github.com/yargs/yargs/issues/766)) ([ab1fa4b](https://github.com/yargs/yargs/commit/ab1fa4b))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* `extends` key in config file is now used for extending other config files
|
||||
* environment variables now take precedence over config files.
|
||||
* context now takes precedence over argv and defaults
|
||||
* the arguments passed to functions are now validated, there's a good chance this will throw exceptions for a few folks who are using the API in an unexpected way.
|
||||
* by default options, and many of yargs' parsing helpers will now default to being applied globally; such that they are no-longer reset before being passed into commands.
|
||||
* yargs will no longer aggressively suppress errors, allowing errors that are not generated internally to bubble.
|
||||
|
||||
|
||||
|
||||
<a name="6.6.0"></a>
|
||||
# [6.6.0](https://github.com/yargs/yargs/compare/v6.5.0...v6.6.0) (2016-12-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* [object Object] was accidentally being populated on options object ([#736](https://github.com/yargs/yargs/issues/736)) ([f755e27](https://github.com/yargs/yargs/commit/f755e27))
|
||||
* do not use cwd when resolving package.json for yargs parsing config ([#726](https://github.com/yargs/yargs/issues/726)) ([9bdaab7](https://github.com/yargs/yargs/commit/9bdaab7))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* implement conflicts() for defining mutually exclusive arguments; thanks [@madcampos](https://github.com/madcampos)! ([#741](https://github.com/yargs/yargs/issues/741)) ([5883779](https://github.com/yargs/yargs/commit/5883779))
|
||||
* split demand() into demandCommand()/demandOption() ([#740](https://github.com/yargs/yargs/issues/740)) ([66573c8](https://github.com/yargs/yargs/commit/66573c8))
|
||||
* support for positional argument aliases ([#727](https://github.com/yargs/yargs/issues/727)) ([27e1a57](https://github.com/yargs/yargs/commit/27e1a57))
|
||||
|
||||
|
||||
|
||||
<a name="6.5.0"></a>
|
||||
# [6.5.0](https://github.com/yargs/yargs/compare/v6.4.0...v6.5.0) (2016-12-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* still freeze/unfreeze if parse() is called in isolation ([#717](https://github.com/yargs/yargs/issues/717)) ([30a9492](https://github.com/yargs/yargs/commit/30a9492))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* pull in yargs-parser introducing additional settings ([#688](https://github.com/yargs/yargs/issues/688)), and fixing [#716](https://github.com/yargs/yargs/issues/716) ([#722](https://github.com/yargs/yargs/issues/722)) ([702995a](https://github.com/yargs/yargs/commit/702995a))
|
||||
|
||||
|
||||
|
||||
<a name="6.4.0"></a>
|
||||
# [6.4.0](https://github.com/yargs/yargs/compare/v6.3.0...v6.4.0) (2016-11-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **locales:** correct some Russian translations ([#691](https://github.com/yargs/yargs/issues/691)) ([a980671](https://github.com/yargs/yargs/commit/a980671))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **locales:** Added Belarusian translation ([#690](https://github.com/yargs/yargs/issues/690)) ([68dac1f](https://github.com/yargs/yargs/commit/68dac1f))
|
||||
* **locales:** Create nl.json ([#687](https://github.com/yargs/yargs/issues/687)) ([46ce1bb](https://github.com/yargs/yargs/commit/46ce1bb))
|
||||
* update to yargs-parser that addresses [#598](https://github.com/yargs/yargs/issues/598), [#617](https://github.com/yargs/yargs/issues/617) ([#700](https://github.com/yargs/yargs/issues/700)) ([54cb31d](https://github.com/yargs/yargs/commit/54cb31d))
|
||||
* yargs is now passed as the third-argument to fail handler ([#613](https://github.com/yargs/yargs/issues/613)) ([21b74f9](https://github.com/yargs/yargs/commit/21b74f9))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* normalizing package data is an expensive operation ([#705](https://github.com/yargs/yargs/issues/705)) ([49cf533](https://github.com/yargs/yargs/commit/49cf533))
|
||||
|
||||
|
||||
|
||||
<a name="6.3.0"></a>
|
||||
# [6.3.0](https://github.com/yargs/yargs/compare/v6.2.0...v6.3.0) (2016-10-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **command:** subcommands via commandDir() now supported for parse(msg, cb) ([#678](https://github.com/yargs/yargs/issues/678)) ([6b85cc6](https://github.com/yargs/yargs/commit/6b85cc6))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **locales:** Add Thai locale file ([#679](https://github.com/yargs/yargs/issues/679)) ([c05e36b](https://github.com/yargs/yargs/commit/c05e36b))
|
||||
|
||||
|
||||
|
||||
<a name="6.2.0"></a>
|
||||
# [6.2.0](https://github.com/yargs/yargs/compare/v6.1.1...v6.2.0) (2016-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* stop applying parser to context object ([#675](https://github.com/yargs/yargs/issues/675)) ([3fe9b8f](https://github.com/yargs/yargs/commit/3fe9b8f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add new pt_BR translations ([#674](https://github.com/yargs/yargs/issues/674)) ([5615a82](https://github.com/yargs/yargs/commit/5615a82))
|
||||
* Italian translations for 'did you mean' and 'aliases' ([#673](https://github.com/yargs/yargs/issues/673)) ([81984e6](https://github.com/yargs/yargs/commit/81984e6))
|
||||
|
||||
|
||||
|
||||
<a name="6.1.1"></a>
|
||||
## [6.1.1](https://github.com/yargs/yargs/compare/v6.1.0...v6.1.1) (2016-10-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* freeze was not resetting configObjects to initial state; addressed performance issue raised by [@nexdrew](https://github.com/nexdrew). ([#670](https://github.com/yargs/yargs/issues/670)) ([ae4bcd4](https://github.com/yargs/yargs/commit/ae4bcd4))
|
||||
|
||||
|
||||
|
||||
<a name="6.1.0"></a>
|
||||
# [6.1.0](https://github.com/yargs/yargs/compare/v6.0.0...v6.1.0) (2016-10-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **locales:** change some translations ([#667](https://github.com/yargs/yargs/issues/667)) ([aa966c5](https://github.com/yargs/yargs/commit/aa966c5))
|
||||
* **locales:** conform hi locale to y18n.__n expectations ([#666](https://github.com/yargs/yargs/issues/666)) ([22adb18](https://github.com/yargs/yargs/commit/22adb18))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* initial support for command aliases ([#647](https://github.com/yargs/yargs/issues/647)) ([127a040](https://github.com/yargs/yargs/commit/127a040))
|
||||
* **command:** add camelcase commands to argv ([#658](https://github.com/yargs/yargs/issues/658)) ([b1cabae](https://github.com/yargs/yargs/commit/b1cabae))
|
||||
* **locales:** add Hindi translations ([9290912](https://github.com/yargs/yargs/commit/9290912))
|
||||
* **locales:** add Hungarian translations ([be92327](https://github.com/yargs/yargs/commit/be92327))
|
||||
* **locales:** Japanese translations for 'did you mean' and 'aliases' ([#651](https://github.com/yargs/yargs/issues/651)) ([5eb78fc](https://github.com/yargs/yargs/commit/5eb78fc))
|
||||
* **locales:** Polish translations for 'did you mean' and 'aliases' ([#650](https://github.com/yargs/yargs/issues/650)) ([c951c0e](https://github.com/yargs/yargs/commit/c951c0e))
|
||||
* reworking yargs API to make it easier to run in headless environments, e.g., Slack ([#646](https://github.com/yargs/yargs/issues/646)) ([f284c29](https://github.com/yargs/yargs/commit/f284c29))
|
||||
* Turkish translations for 'did you mean' and 'aliases' ([#660](https://github.com/yargs/yargs/issues/660)) ([072fd45](https://github.com/yargs/yargs/commit/072fd45))
|
||||
|
||||
|
||||
|
||||
<a name="6.0.0"></a>
|
||||
# [6.0.0](https://github.com/yargs/yargs/compare/v5.0.0...v6.0.0) (2016-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* changed parsing of the command string to ignore extra spaces ([#600](https://github.com/yargs/yargs/issues/600)) ([e8e5a72](https://github.com/yargs/yargs/commit/e8e5a72))
|
||||
* drop lodash.assign ([#641](https://github.com/yargs/yargs/issues/641)) ([ad3146f](https://github.com/yargs/yargs/commit/ad3146f))
|
||||
* for args that have skipValidation set to `true`, check if the parsed arg is `true` ([#619](https://github.com/yargs/yargs/issues/619)) ([658a34c](https://github.com/yargs/yargs/commit/658a34c))
|
||||
* upgrade standard, and fix appveyor config so that it works with newest standard ([#607](https://github.com/yargs/yargs/issues/607)) ([c301f42](https://github.com/yargs/yargs/commit/c301f42))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* upgrade yargs-parser ([#633](https://github.com/yargs/yargs/issues/633)) ([cc1224e](https://github.com/yargs/yargs/commit/cc1224e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* make opts object optional for .option() ([#624](https://github.com/yargs/yargs/issues/624)) ([4f29de6](https://github.com/yargs/yargs/commit/4f29de6))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* defer windowWidth() to improve perf for non-help usage ([#610](https://github.com/yargs/yargs/issues/610)) ([cbc3636](https://github.com/yargs/yargs/commit/cbc3636))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* coerce is now applied as a final step after other parsing is complete
|
||||
|
||||
|
||||
|
||||
<a name="5.0.0"></a>
|
||||
# [5.0.0](https://github.com/yargs/yargs/compare/v4.8.1...v5.0.0) (2016-08-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **default:** Remove undocumented alias of default() ([#469](https://github.com/yargs/yargs/issues/469)) ([b8591b2](https://github.com/yargs/yargs/commit/b8591b2))
|
||||
* remove deprecated zh.json ([#578](https://github.com/yargs/yargs/issues/578)) ([317c62c](https://github.com/yargs/yargs/commit/317c62c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* .help() API can now enable implicit help command ([#574](https://github.com/yargs/yargs/issues/574)) ([7645019](https://github.com/yargs/yargs/commit/7645019))
|
||||
* **command:** builder function no longer needs to return the yargs instance ([#549](https://github.com/yargs/yargs/issues/549)) ([eaa2873](https://github.com/yargs/yargs/commit/eaa2873))
|
||||
* add coerce api ([#586](https://github.com/yargs/yargs/issues/586)) ([1d53ccb](https://github.com/yargs/yargs/commit/1d53ccb))
|
||||
* adds recommendCommands() for command suggestions ([#580](https://github.com/yargs/yargs/issues/580)) ([59474dc](https://github.com/yargs/yargs/commit/59474dc))
|
||||
* apply .env() globally ([#553](https://github.com/yargs/yargs/issues/553)) ([be65728](https://github.com/yargs/yargs/commit/be65728))
|
||||
* apply default builder to command() and apply fail() handlers globally ([#583](https://github.com/yargs/yargs/issues/583)) ([0aaa68b](https://github.com/yargs/yargs/commit/0aaa68b))
|
||||
* update yargs-parser to version 3.1.0 ([#581](https://github.com/yargs/yargs/issues/581)) ([882a127](https://github.com/yargs/yargs/commit/882a127))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* defer requiring most external libs until needed ([#584](https://github.com/yargs/yargs/issues/584)) ([f9b0ed4](https://github.com/yargs/yargs/commit/f9b0ed4))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* fail is now applied globally.
|
||||
* we now default to an empty builder function when command is executed with no builder.
|
||||
* yargs-parser now better handles negative integer values, at the cost of handling numeric option names, e.g., -1 hello
|
||||
* default: removed undocumented `defaults` alias for `default`.
|
||||
* introduces a default `help` command which outputs help, as an alternative to a help flag.
|
||||
* interpret demand() numbers as relative to executing command ([#582](https://github.com/yargs/yargs/issues/582)) ([927810c](https://github.com/yargs/yargs/commit/927810c))
|
||||
|
||||
|
||||
|
||||
<a name="4.8.1"></a>
|
||||
## [4.8.1](https://github.com/yargs/yargs/compare/v4.8.0...v4.8.1) (2016-07-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **commandDir:** make dir relative to caller instead of require.main.filename ([#548](https://github.com/yargs/yargs/issues/548)) ([3c2e479](https://github.com/yargs/yargs/commit/3c2e479))
|
||||
* add config lookup for .implies() ([#556](https://github.com/yargs/yargs/issues/556)) ([8d7585c](https://github.com/yargs/yargs/commit/8d7585c))
|
||||
* cache pkg lookups by path to avoid returning the wrong one ([#552](https://github.com/yargs/yargs/issues/552)) ([fea7e0b](https://github.com/yargs/yargs/commit/fea7e0b))
|
||||
* positional arguments were not being handled appropriately by parse() ([#559](https://github.com/yargs/yargs/issues/559)) ([063a866](https://github.com/yargs/yargs/commit/063a866))
|
||||
* pull in [@nexdrew](https://github.com/nexdrew)'s fixes to yargs-parser ([#560](https://github.com/yargs/yargs/issues/560)) ([c77c080](https://github.com/yargs/yargs/commit/c77c080)), closes [#560](https://github.com/yargs/yargs/issues/560)
|
||||
|
||||
|
||||
|
||||
<a name="4.8.0"></a>
|
||||
# [4.8.0](https://github.com/yargs/yargs/compare/v4.7.1...v4.8.0) (2016-07-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* drop unused camelcase dependency fixes [#516](https://github.com/yargs/yargs/issues/516) ([#525](https://github.com/yargs/yargs/issues/525)) ([365fb9a](https://github.com/yargs/yargs/commit/365fb9a)), closes [#516](https://github.com/yargs/yargs/issues/516) [#525](https://github.com/yargs/yargs/issues/525)
|
||||
* fake a tty in tests, so that we can use the new set-blocking ([#512](https://github.com/yargs/yargs/issues/512)) ([a54c742](https://github.com/yargs/yargs/commit/a54c742))
|
||||
* ignore invalid package.json during read-pkg-up ([#546](https://github.com/yargs/yargs/issues/546)) ([e058c87](https://github.com/yargs/yargs/commit/e058c87))
|
||||
* keep both zh and zh_CN until yargs[@5](https://github.com/5).x ([0f8faa7](https://github.com/yargs/yargs/commit/0f8faa7))
|
||||
* lazy-load package.json and cache. get rid of pkg-conf dependency. ([#544](https://github.com/yargs/yargs/issues/544)) ([2609b2e](https://github.com/yargs/yargs/commit/2609b2e))
|
||||
* we now respect the order of _ when applying commands ([#537](https://github.com/yargs/yargs/issues/537)) ([ed86b78](https://github.com/yargs/yargs/commit/ed86b78))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add .commandDir(dir) to API to apply all command modules from a relative directory ([#494](https://github.com/yargs/yargs/issues/494)) ([b299dff](https://github.com/yargs/yargs/commit/b299dff))
|
||||
* **command:** derive missing command string from module filename ([#527](https://github.com/yargs/yargs/issues/527)) ([20d4b8a](https://github.com/yargs/yargs/commit/20d4b8a))
|
||||
* builder is now optional for a command module ([#545](https://github.com/yargs/yargs/issues/545)) ([8d6ad6e](https://github.com/yargs/yargs/commit/8d6ad6e))
|
||||
|
||||
|
||||
|
||||
<a name="4.7.1"></a>
|
||||
## [4.7.1](https://github.com/yargs/yargs/compare/v4.7.0...v4.7.1) (2016-05-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* switch to using `const` rather than `var` ([#499](https://github.com/yargs/yargs/pull/499))
|
||||
* make stdout flush on newer versions of Node.js ([#501](https://github.com/yargs/yargs/issues/501)) ([9f8c6f4](https://github.com/yargs/yargs/commit/9f8c6f4))
|
||||
|
||||
|
||||
|
||||
<a name="4.7.0"></a>
|
||||
# [4.7.0](https://github.com/yargs/yargs/compare/v4.6.0...v4.7.0) (2016-05-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **pkgConf:** fix aliases issues in .pkgConf() ([#478](https://github.com/yargs/yargs/issues/478))([b900502](https://github.com/yargs/yargs/commit/b900502))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **completion:** allow to get completions for any string, not just process.argv ([#470](https://github.com/yargs/yargs/issues/470))([74fcfbc](https://github.com/yargs/yargs/commit/74fcfbc))
|
||||
* **configuration:** Allow to directly pass a configuration object to .config() ([#480](https://github.com/yargs/yargs/issues/480))([e0a7e05](https://github.com/yargs/yargs/commit/e0a7e05))
|
||||
* **validation:** Add .skipValidation() method ([#471](https://github.com/yargs/yargs/issues/471))([d72badb](https://github.com/yargs/yargs/commit/d72badb))
|
||||
|
||||
|
||||
|
||||
<a name="4.6.0"></a>
|
||||
# [4.6.0](https://github.com/yargs/yargs/compare/v4.5.0...v4.6.0) (2016-04-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **my brand!:** I agree with [@osher](https://github.com/osher) lightweight isn't a huge selling point of ours any longer, see [#468](https://github.com/yargs/yargs/issues/468) ([c46d7e1](https://github.com/yargs/yargs/commit/c46d7e1))
|
||||
|
||||
### Features
|
||||
|
||||
* switch to standard-version for release management ([f70f801](https://github.com/yargs/yargs/commit/f70f801))
|
||||
* upgrade to version of yargs-parser that introduces some slick new features, great work [@elas7](https://github.com/elas7). update cliui, replace win-spawn, replace badge. ([#475](https://github.com/yargs/yargs/issues/475)) ([f915dd4](https://github.com/yargs/yargs/commit/f915dd4))
|
||||
|
||||
|
||||
|
||||
<a name="4.5.0"></a>
|
||||
# [4.5.0](https://github.com/yargs/yargs/compare/v4.4.0...v4.5.0) (2016-04-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **windows:** handle $0 better on Windows platforms ([eb6e03f](https://github.com/yargs/yargs/commit/eb6e03f))
|
||||
|
||||
### Features
|
||||
|
||||
* **commands:** implemented variadic positional arguments ([51d926e](https://github.com/yargs/yargs/commit/51d926e))
|
||||
* **completion:** completion now better handles aliases, and avoids duplicating keys. ([86416c8](https://github.com/yargs/yargs/commit/86416c8))
|
||||
* **config:** If invoking .config() without parameters, set a default option ([0413dd1](https://github.com/yargs/yargs/commit/0413dd1))
|
||||
* **conventional-changelog:** switching to using conventional-changelog for generating the changelog ([a2b5a2a](https://github.com/yargs/yargs/commit/a2b5a2a))
|
||||
|
||||
|
||||
|
||||
### v4.4.0 (2016/04/03 21:10 +07:00)
|
||||
|
||||
- [#454](https://github.com/yargs/yargs/pull/454) fix demand() when second argument is an array (@elas7)
|
||||
- [#452](https://github.com/yargs/yargs/pull/452) fix code example for `.help()` docs (@maxrimue)
|
||||
- [#450](https://github.com/yargs/yargs/pull/450) fix for bash completion trailing space edge-case (@elas7)
|
||||
- [#448](https://github.com/yargs/yargs/pull/448) allow a method to be passed to `showHelp`, rather than a log-level (@osher)
|
||||
- [#446](https://github.com/yargs/yargs/pull/446) update yargs-parser, y18n, nyc, cliui, pkg-conf (@bcoe)
|
||||
- [#436](https://github.com/yargs/yargs/pull/436) the rebase method is only used by tests, do not export it in two places (@elas7)
|
||||
- [#428](https://github.com/yargs/yargs/pull/428) initial support for subcommands (@nexdrew)
|
||||
|
||||
### v4.3.2 (2016/3/20 15:07 +07:00)
|
||||
|
||||
- [#445](https://github.com/yargs/yargs/pull/445) strict mode was failing if no commands were registered (@nexdrew)
|
||||
- [#443](https://github.com/yargs/yargs/pull/443) adds Italian translation \o/ (@madrisan)
|
||||
- [#441](https://github.com/yargs/yargs/pull/441) remove duplicate keys from array options configuration (@elas7)
|
||||
- [#437](https://github.com/yargs/yargs/pull/437) standardize tests for .command() (@lrlna)
|
||||
|
||||
### v4.3.0 (2016/3/12 14:19 +07:00)
|
||||
|
||||
- [#432](https://github.com/yargs/yargs/pull/432) non-singleton version of yargs (@bcoe)
|
||||
- [#422, #425, #420] translations for number (@zkat, @rilut, @maxrimue, @watilde)
|
||||
- [#414](https://github.com/yargs/yargs/pull/414) all command options can be defined in module now (@nexdrew)
|
||||
|
||||
### v4.2.0 (2016/2/22 11:02 +07:00)
|
||||
|
||||
- [#395](https://github.com/yargs/yargs/pull/395) do not reset groups if they contain
|
||||
global keys (@novemberborn)
|
||||
- [#393](https://github.com/yargs/yargs/pull/393) use sane default for usage strings (@nexdrew)
|
||||
- [#392](https://github.com/yargs/yargs/pull/392) resetting wrap() was causing layout issues
|
||||
with commands (@nexdrew)
|
||||
- [#391](https://github.com/yargs/yargs/pull/391) commands were being added multiple times (@nexdrew)
|
||||
|
||||
### v4.0.0 (2016/2/14 1:27 +07:00)
|
||||
|
||||
- [#384](https://github.com/bcoe/yargs/pull/384) add new number type to yargs (@lrlna, @maxrimue)
|
||||
- [#382](https://github.com/bcoe/yargs/pull/382) pass error as extra parameter to fail (@gajus)
|
||||
- [#378](https://github.com/bcoe/yargs/pull/378) introduces the pkgConf feature, which tells
|
||||
yargs to load default argument values from a key on a project's package.json (@bcoe)
|
||||
- [#376](https://github.com/bcoe/yargs/pull/376) **breaking change**, make help() method signature
|
||||
more consistent with other commands (@maxrimue)
|
||||
- [#368](https://github.com/bcoe/yargs/pull/368) **breaking change**, overhaul to command handling API:
|
||||
introducing named positional arguments, commands as modules, introduces the concept of global options (options that don't reset). (@nexdrew, @bcoe).
|
||||
- [#364](https://github.com/bcoe/yargs/pull/364) add the slick new yargs website to the package.json (@iarna).
|
||||
- [#357](https://github.com/bcoe/yargs/pull/357) .strict() now requires that a valid command is provided (@lrlna)
|
||||
- [#356](https://github.com/bcoe/yargs/pull/356) pull the parsing bits of yargs into the separate module yargs-parser. Various parsing options can now be turned on and off using configuration (@bcoe).
|
||||
- [#330](https://github.com/bcoe/yargs/pull/330) **breaking change**, fix inconsistencies with `.version()` API. (@maxrimue).
|
||||
|
||||
### v3.32.0 (2016/1/14 10:13 +07:00)
|
||||
|
||||
@ -14,7 +899,7 @@
|
||||
- [#308](https://github.com/bcoe/yargs/pull/308) Yargs now handles environment variables (@nexdrew)
|
||||
- [#302](https://github.com/bcoe/yargs/pull/302) Add Indonesian translation (@rilut)
|
||||
- [#300](https://github.com/bcoe/yargs/pull/300) Add Turkish translation (@feyzo)
|
||||
- [#298](https://github.com/bcoe/yargs/pull/298) Add Norwegian Bokmål translation (@sindresorhus)
|
||||
- [#298](https://github.com/bcoe/yargs/pull/298) Add Norwegian Bokmål translation (@sindresorhus)
|
||||
- [#297](https://github.com/bcoe/yargs/pull/297) Fix for layout of cjk characters (@disjukr)
|
||||
- [#296](https://github.com/bcoe/yargs/pull/296) Add Korean translation (@disjukr)
|
||||
|
||||
|
1
node_modules/yargs/LICENSE
generated
vendored
1
node_modules/yargs/LICENSE
generated
vendored
@ -1,4 +1,5 @@
|
||||
Copyright 2010 James Halliday (mail@substack.net)
|
||||
Modified work Copyright 2014 Contributors (ben@npmjs.com)
|
||||
|
||||
This project is free software released under the MIT/X11 license:
|
||||
|
||||
|
1301
node_modules/yargs/README.md
generated
vendored
1301
node_modules/yargs/README.md
generated
vendored
File diff suppressed because it is too large
Load Diff
28
node_modules/yargs/completion.sh.hbs
generated
vendored
28
node_modules/yargs/completion.sh.hbs
generated
vendored
@ -1,28 +0,0 @@
|
||||
###-begin-{{app_name}}-completions-###
|
||||
#
|
||||
# yargs command completion script
|
||||
#
|
||||
# Installation: {{app_path}} completion >> ~/.bashrc
|
||||
# or {{app_path}} completion >> ~/.bash_profile on OSX.
|
||||
#
|
||||
_yargs_completions()
|
||||
{
|
||||
local cur_word args type_list
|
||||
|
||||
cur_word="${COMP_WORDS[COMP_CWORD]}"
|
||||
args=$(printf "%s " "${COMP_WORDS[@]}")
|
||||
|
||||
# ask yargs to generate completions.
|
||||
type_list=`{{app_path}} --get-yargs-completions $args`
|
||||
|
||||
COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )
|
||||
|
||||
# if no match was found, fall back to filename completion
|
||||
if [ ${#COMPREPLY[@]} -eq 0 ]; then
|
||||
COMPREPLY=( $(compgen -f -- "${cur_word}" ) )
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
complete -F _yargs_completions {{app_name}}
|
||||
###-end-{{app_name}}-completions-###
|
664
node_modules/yargs/index.js
generated
vendored
664
node_modules/yargs/index.js
generated
vendored
@ -1,650 +1,17 @@
|
||||
var assert = require('assert')
|
||||
var Completion = require('./lib/completion')
|
||||
var Parser = require('./lib/parser')
|
||||
var path = require('path')
|
||||
var tokenizeArgString = require('./lib/tokenize-arg-string')
|
||||
var Usage = require('./lib/usage')
|
||||
var Validation = require('./lib/validation')
|
||||
var Y18n = require('y18n')
|
||||
'use strict'
|
||||
// classic singleton yargs API, to use yargs
|
||||
// without running as a singleton do:
|
||||
// require('yargs/yargs')(process.argv.slice(2))
|
||||
const yargs = require('./yargs')
|
||||
|
||||
Argv(process.argv.slice(2))
|
||||
|
||||
var exports = module.exports = Argv
|
||||
module.exports = Argv
|
||||
|
||||
function Argv (processArgs, cwd) {
|
||||
processArgs = processArgs || [] // handle calling yargs().
|
||||
|
||||
var self = {}
|
||||
var completion = null
|
||||
var usage = null
|
||||
var validation = null
|
||||
var y18n = Y18n({
|
||||
directory: path.resolve(__dirname, './locales'),
|
||||
updateFiles: false
|
||||
})
|
||||
|
||||
if (!cwd) cwd = process.cwd()
|
||||
|
||||
self.$0 = process.argv
|
||||
.slice(0, 2)
|
||||
.map(function (x, i) {
|
||||
// ignore the node bin, specify this in your
|
||||
// bin file with #!/usr/bin/env node
|
||||
if (i === 0 && /\b(node|iojs)$/.test(x)) return
|
||||
var b = rebase(cwd, x)
|
||||
return x.match(/^\//) && b.length < x.length ? b : x
|
||||
})
|
||||
.join(' ').trim()
|
||||
|
||||
if (process.env._ !== undefined && process.argv[1] === process.env._) {
|
||||
self.$0 = process.env._.replace(
|
||||
path.dirname(process.execPath) + '/', ''
|
||||
)
|
||||
}
|
||||
|
||||
var options
|
||||
self.resetOptions = self.reset = function () {
|
||||
// put yargs back into its initial
|
||||
// state, this is useful for creating a
|
||||
// nested CLI.
|
||||
options = {
|
||||
array: [],
|
||||
boolean: [],
|
||||
string: [],
|
||||
narg: {},
|
||||
key: {},
|
||||
alias: {},
|
||||
default: {},
|
||||
defaultDescription: {},
|
||||
choices: {},
|
||||
requiresArg: [],
|
||||
count: [],
|
||||
normalize: [],
|
||||
config: {},
|
||||
envPrefix: undefined
|
||||
}
|
||||
|
||||
usage = Usage(self, y18n) // handle usage output.
|
||||
validation = Validation(self, usage, y18n) // handle arg validation.
|
||||
completion = Completion(self, usage)
|
||||
|
||||
demanded = {}
|
||||
groups = {}
|
||||
|
||||
exitProcess = true
|
||||
strict = false
|
||||
helpOpt = null
|
||||
versionOpt = null
|
||||
commandHandlers = {}
|
||||
self.parsed = false
|
||||
|
||||
return self
|
||||
}
|
||||
self.resetOptions()
|
||||
|
||||
self.boolean = function (bools) {
|
||||
options.boolean.push.apply(options.boolean, [].concat(bools))
|
||||
return self
|
||||
}
|
||||
|
||||
self.array = function (arrays) {
|
||||
options.array.push.apply(options.array, [].concat(arrays))
|
||||
return self
|
||||
}
|
||||
|
||||
self.nargs = function (key, n) {
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach(function (k) {
|
||||
self.nargs(k, key[k])
|
||||
})
|
||||
} else {
|
||||
options.narg[key] = n
|
||||
}
|
||||
return self
|
||||
}
|
||||
|
||||
self.choices = function (key, values) {
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach(function (k) {
|
||||
self.choices(k, key[k])
|
||||
})
|
||||
} else {
|
||||
options.choices[key] = (options.choices[key] || []).concat(values)
|
||||
}
|
||||
return self
|
||||
}
|
||||
|
||||
self.normalize = function (strings) {
|
||||
options.normalize.push.apply(options.normalize, [].concat(strings))
|
||||
return self
|
||||
}
|
||||
|
||||
self.config = function (key, msg, parseFn) {
|
||||
if (typeof msg === 'function') {
|
||||
parseFn = msg
|
||||
msg = null
|
||||
}
|
||||
self.describe(key, msg || usage.deferY18nLookup('Path to JSON config file'))
|
||||
;(Array.isArray(key) ? key : [key]).forEach(function (k) {
|
||||
options.config[k] = parseFn || true
|
||||
})
|
||||
return self
|
||||
}
|
||||
|
||||
self.example = function (cmd, description) {
|
||||
usage.example(cmd, description)
|
||||
return self
|
||||
}
|
||||
|
||||
self.command = function (cmd, description, fn) {
|
||||
if (description !== false) {
|
||||
usage.command(cmd, description)
|
||||
}
|
||||
if (fn) commandHandlers[cmd] = fn
|
||||
return self
|
||||
}
|
||||
|
||||
var commandHandlers = {}
|
||||
self.getCommandHandlers = function () {
|
||||
return commandHandlers
|
||||
}
|
||||
|
||||
self.string = function (strings) {
|
||||
options.string.push.apply(options.string, [].concat(strings))
|
||||
return self
|
||||
}
|
||||
|
||||
self.default = function (key, value, defaultDescription) {
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach(function (k) {
|
||||
self.default(k, key[k])
|
||||
})
|
||||
} else {
|
||||
if (defaultDescription) options.defaultDescription[key] = defaultDescription
|
||||
if (typeof value === 'function') {
|
||||
if (!options.defaultDescription[key]) options.defaultDescription[key] = usage.functionDescription(value)
|
||||
value = value.call()
|
||||
}
|
||||
options.default[key] = value
|
||||
}
|
||||
return self
|
||||
}
|
||||
|
||||
self.alias = function (x, y) {
|
||||
if (typeof x === 'object') {
|
||||
Object.keys(x).forEach(function (key) {
|
||||
self.alias(key, x[key])
|
||||
})
|
||||
} else {
|
||||
// perhaps 'x' is already an alias in another list?
|
||||
// if so we should append to x's list.
|
||||
var aliases = null
|
||||
Object.keys(options.alias).forEach(function (key) {
|
||||
if (~options.alias[key].indexOf(x)) aliases = options.alias[key]
|
||||
})
|
||||
|
||||
if (aliases) { // x was an alias itself.
|
||||
aliases.push(y)
|
||||
} else { // x is a new alias key.
|
||||
options.alias[x] = (options.alias[x] || []).concat(y)
|
||||
}
|
||||
|
||||
// wait! perhaps we've created two lists of aliases
|
||||
// that reference each other?
|
||||
if (options.alias[y]) {
|
||||
Array.prototype.push.apply((options.alias[x] || aliases), options.alias[y])
|
||||
delete options.alias[y]
|
||||
}
|
||||
}
|
||||
return self
|
||||
}
|
||||
|
||||
self.count = function (counts) {
|
||||
options.count.push.apply(options.count, [].concat(counts))
|
||||
return self
|
||||
}
|
||||
|
||||
var demanded = {}
|
||||
self.demand = self.required = self.require = function (keys, max, msg) {
|
||||
// you can optionally provide a 'max' key,
|
||||
// which will raise an exception if too many '_'
|
||||
// options are provided.
|
||||
if (typeof max !== 'number') {
|
||||
msg = max
|
||||
max = Infinity
|
||||
}
|
||||
|
||||
if (typeof keys === 'number') {
|
||||
if (!demanded._) demanded._ = { count: 0, msg: null, max: max }
|
||||
demanded._.count = keys
|
||||
demanded._.msg = msg
|
||||
} else if (Array.isArray(keys)) {
|
||||
keys.forEach(function (key) {
|
||||
self.demand(key, msg)
|
||||
})
|
||||
} else {
|
||||
if (typeof msg === 'string') {
|
||||
demanded[keys] = { msg: msg }
|
||||
} else if (msg === true || typeof msg === 'undefined') {
|
||||
demanded[keys] = { msg: undefined }
|
||||
}
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
self.getDemanded = function () {
|
||||
return demanded
|
||||
}
|
||||
|
||||
self.requiresArg = function (requiresArgs) {
|
||||
options.requiresArg.push.apply(options.requiresArg, [].concat(requiresArgs))
|
||||
return self
|
||||
}
|
||||
|
||||
self.implies = function (key, value) {
|
||||
validation.implies(key, value)
|
||||
return self
|
||||
}
|
||||
|
||||
self.usage = function (msg, opts) {
|
||||
if (!opts && typeof msg === 'object') {
|
||||
opts = msg
|
||||
msg = null
|
||||
}
|
||||
|
||||
usage.usage(msg)
|
||||
|
||||
if (opts) self.options(opts)
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
self.epilogue = self.epilog = function (msg) {
|
||||
usage.epilog(msg)
|
||||
return self
|
||||
}
|
||||
|
||||
self.fail = function (f) {
|
||||
usage.failFn(f)
|
||||
return self
|
||||
}
|
||||
|
||||
self.check = function (f) {
|
||||
validation.check(f)
|
||||
return self
|
||||
}
|
||||
|
||||
self.defaults = self.default
|
||||
|
||||
self.describe = function (key, desc) {
|
||||
options.key[key] = true
|
||||
usage.describe(key, desc)
|
||||
return self
|
||||
}
|
||||
|
||||
self.parse = function (args) {
|
||||
return parseArgs(args)
|
||||
}
|
||||
|
||||
self.option = self.options = function (key, opt) {
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach(function (k) {
|
||||
self.options(k, key[k])
|
||||
})
|
||||
} else {
|
||||
assert(typeof opt === 'object', 'second argument to option must be an object')
|
||||
|
||||
options.key[key] = true // track manually set keys.
|
||||
|
||||
if (opt.alias) self.alias(key, opt.alias)
|
||||
|
||||
var demand = opt.demand || opt.required || opt.require
|
||||
|
||||
if (demand) {
|
||||
self.demand(key, demand)
|
||||
} if ('config' in opt) {
|
||||
self.config(key, opt.configParser)
|
||||
} if ('default' in opt) {
|
||||
self.default(key, opt.default)
|
||||
} if ('nargs' in opt) {
|
||||
self.nargs(key, opt.nargs)
|
||||
} if ('choices' in opt) {
|
||||
self.choices(key, opt.choices)
|
||||
} if ('group' in opt) {
|
||||
self.group(key, opt.group)
|
||||
} if (opt.boolean || opt.type === 'boolean') {
|
||||
self.boolean(key)
|
||||
if (opt.alias) self.boolean(opt.alias)
|
||||
} if (opt.array || opt.type === 'array') {
|
||||
self.array(key)
|
||||
if (opt.alias) self.array(opt.alias)
|
||||
} if (opt.string || opt.type === 'string') {
|
||||
self.string(key)
|
||||
if (opt.alias) self.string(opt.alias)
|
||||
} if (opt.count || opt.type === 'count') {
|
||||
self.count(key)
|
||||
} if (opt.defaultDescription) {
|
||||
options.defaultDescription[key] = opt.defaultDescription
|
||||
}
|
||||
|
||||
var desc = opt.describe || opt.description || opt.desc
|
||||
if (desc) {
|
||||
self.describe(key, desc)
|
||||
}
|
||||
|
||||
if (opt.requiresArg) {
|
||||
self.requiresArg(key)
|
||||
}
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
self.getOptions = function () {
|
||||
return options
|
||||
}
|
||||
|
||||
var groups = {}
|
||||
self.group = function (opts, groupName) {
|
||||
var seen = {}
|
||||
groups[groupName] = (groups[groupName] || []).concat(opts).filter(function (key) {
|
||||
if (seen[key]) return false
|
||||
return (seen[key] = true)
|
||||
})
|
||||
return self
|
||||
}
|
||||
self.getGroups = function () {
|
||||
return groups
|
||||
}
|
||||
|
||||
// as long as options.envPrefix is not undefined,
|
||||
// parser will apply env vars matching prefix to argv
|
||||
self.env = function (prefix) {
|
||||
if (prefix === false) options.envPrefix = undefined
|
||||
else options.envPrefix = prefix || ''
|
||||
return self
|
||||
}
|
||||
|
||||
self.wrap = function (cols) {
|
||||
usage.wrap(cols)
|
||||
return self
|
||||
}
|
||||
|
||||
var strict = false
|
||||
self.strict = function () {
|
||||
strict = true
|
||||
return self
|
||||
}
|
||||
self.getStrict = function () {
|
||||
return strict
|
||||
}
|
||||
|
||||
self.showHelp = function (level) {
|
||||
if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed.
|
||||
usage.showHelp(level)
|
||||
return self
|
||||
}
|
||||
|
||||
var versionOpt = null
|
||||
self.version = function (ver, opt, msg) {
|
||||
versionOpt = opt || 'version'
|
||||
usage.version(ver)
|
||||
self.boolean(versionOpt)
|
||||
self.describe(versionOpt, msg || usage.deferY18nLookup('Show version number'))
|
||||
return self
|
||||
}
|
||||
|
||||
var helpOpt = null
|
||||
self.addHelpOpt = function (opt, msg) {
|
||||
helpOpt = opt
|
||||
self.boolean(opt)
|
||||
self.describe(opt, msg || usage.deferY18nLookup('Show help'))
|
||||
return self
|
||||
}
|
||||
|
||||
self.showHelpOnFail = function (enabled, message) {
|
||||
usage.showHelpOnFail(enabled, message)
|
||||
return self
|
||||
}
|
||||
|
||||
var exitProcess = true
|
||||
self.exitProcess = function (enabled) {
|
||||
if (typeof enabled !== 'boolean') {
|
||||
enabled = true
|
||||
}
|
||||
exitProcess = enabled
|
||||
return self
|
||||
}
|
||||
self.getExitProcess = function () {
|
||||
return exitProcess
|
||||
}
|
||||
|
||||
self.help = function () {
|
||||
if (arguments.length > 0) return self.addHelpOpt.apply(self, arguments)
|
||||
|
||||
if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed.
|
||||
|
||||
return usage.help()
|
||||
}
|
||||
|
||||
var completionCommand = null
|
||||
self.completion = function (cmd, desc, fn) {
|
||||
// a function to execute when generating
|
||||
// completions can be provided as the second
|
||||
// or third argument to completion.
|
||||
if (typeof desc === 'function') {
|
||||
fn = desc
|
||||
desc = null
|
||||
}
|
||||
|
||||
// register the completion command.
|
||||
completionCommand = cmd || 'completion'
|
||||
if (!desc && desc !== false) {
|
||||
desc = 'generate bash completion script'
|
||||
}
|
||||
self.command(completionCommand, desc)
|
||||
|
||||
// a function can be provided
|
||||
if (fn) completion.registerFunction(fn)
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
self.showCompletionScript = function ($0) {
|
||||
$0 = $0 || self.$0
|
||||
console.log(completion.generateCompletionScript($0))
|
||||
return self
|
||||
}
|
||||
|
||||
self.locale = function (locale) {
|
||||
if (arguments.length === 0) {
|
||||
guessLocale()
|
||||
return y18n.getLocale()
|
||||
}
|
||||
detectLocale = false
|
||||
y18n.setLocale(locale)
|
||||
return self
|
||||
}
|
||||
|
||||
self.updateStrings = self.updateLocale = function (obj) {
|
||||
detectLocale = false
|
||||
y18n.updateLocale(obj)
|
||||
return self
|
||||
}
|
||||
|
||||
var detectLocale = true
|
||||
self.detectLocale = function (detect) {
|
||||
detectLocale = detect
|
||||
return self
|
||||
}
|
||||
self.getDetectLocale = function () {
|
||||
return detectLocale
|
||||
}
|
||||
|
||||
self.getUsageInstance = function () {
|
||||
return usage
|
||||
}
|
||||
|
||||
self.getValidationInstance = function () {
|
||||
return validation
|
||||
}
|
||||
|
||||
self.terminalWidth = function () {
|
||||
return require('window-size').width
|
||||
}
|
||||
|
||||
Object.defineProperty(self, 'argv', {
|
||||
get: function () {
|
||||
var args = null
|
||||
|
||||
try {
|
||||
args = parseArgs(processArgs)
|
||||
} catch (err) {
|
||||
usage.fail(err.message)
|
||||
}
|
||||
|
||||
return args
|
||||
},
|
||||
enumerable: true
|
||||
})
|
||||
|
||||
function parseArgs (args) {
|
||||
args = normalizeArgs(args)
|
||||
|
||||
var parsed = Parser(args, options, y18n)
|
||||
var argv = parsed.argv
|
||||
var aliases = parsed.aliases
|
||||
|
||||
argv.$0 = self.$0
|
||||
|
||||
self.parsed = parsed
|
||||
|
||||
guessLocale() // guess locale lazily, so that it can be turned off in chain.
|
||||
|
||||
// while building up the argv object, there
|
||||
// are two passes through the parser. If completion
|
||||
// is being performed short-circuit on the first pass.
|
||||
if (completionCommand &&
|
||||
(process.argv.join(' ')).indexOf(completion.completionKey) !== -1 &&
|
||||
!argv[completion.completionKey]) {
|
||||
return argv
|
||||
}
|
||||
|
||||
// if there's a handler associated with a
|
||||
// command defer processing to it.
|
||||
var handlerKeys = Object.keys(self.getCommandHandlers())
|
||||
for (var i = 0, command; (command = handlerKeys[i]) !== undefined; i++) {
|
||||
if (~argv._.indexOf(command)) {
|
||||
runCommand(command, self, argv)
|
||||
return self.argv
|
||||
}
|
||||
}
|
||||
|
||||
// generate a completion script for adding to ~/.bashrc.
|
||||
if (completionCommand && ~argv._.indexOf(completionCommand) && !argv[completion.completionKey]) {
|
||||
self.showCompletionScript()
|
||||
if (exitProcess) {
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
// we must run completions first, a user might
|
||||
// want to complete the --help or --version option.
|
||||
if (completion.completionKey in argv) {
|
||||
// we allow for asynchronous completions,
|
||||
// e.g., loading in a list of commands from an API.
|
||||
completion.getCompletion(function (completions) {
|
||||
;(completions || []).forEach(function (completion) {
|
||||
console.log(completion)
|
||||
})
|
||||
|
||||
if (exitProcess) {
|
||||
process.exit(0)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
var helpOrVersion = false
|
||||
Object.keys(argv).forEach(function (key) {
|
||||
if (key === helpOpt && argv[key]) {
|
||||
helpOrVersion = true
|
||||
self.showHelp('log')
|
||||
if (exitProcess) {
|
||||
process.exit(0)
|
||||
}
|
||||
} else if (key === versionOpt && argv[key]) {
|
||||
helpOrVersion = true
|
||||
usage.showVersion()
|
||||
if (exitProcess) {
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// If the help or version options where used and exitProcess is false,
|
||||
// we won't run validations
|
||||
if (!helpOrVersion) {
|
||||
if (parsed.error) throw parsed.error
|
||||
|
||||
// if we're executed via bash completion, don't
|
||||
// bother with validation.
|
||||
if (!argv[completion.completionKey]) {
|
||||
validation.nonOptionCount(argv)
|
||||
validation.missingArgumentValue(argv)
|
||||
validation.requiredArguments(argv)
|
||||
if (strict) validation.unknownArguments(argv, aliases)
|
||||
validation.customChecks(argv, aliases)
|
||||
validation.limitedChoices(argv)
|
||||
validation.implications(argv)
|
||||
}
|
||||
}
|
||||
|
||||
setPlaceholderKeys(argv)
|
||||
|
||||
return argv
|
||||
}
|
||||
|
||||
function guessLocale () {
|
||||
if (!detectLocale) return
|
||||
|
||||
try {
|
||||
var osLocale = require('os-locale')
|
||||
self.locale(osLocale.sync({ spawn: false }))
|
||||
} catch (err) {
|
||||
// if we explode looking up locale just noop
|
||||
// we'll keep using the default language 'en'.
|
||||
}
|
||||
}
|
||||
|
||||
function runCommand (command, yargs, argv) {
|
||||
setPlaceholderKeys(argv)
|
||||
yargs.getCommandHandlers()[command](yargs.reset(), argv)
|
||||
}
|
||||
|
||||
function setPlaceholderKeys (argv) {
|
||||
Object.keys(options.key).forEach(function (key) {
|
||||
// don't set placeholder keys for dot
|
||||
// notation options 'foo.bar'.
|
||||
if (~key.indexOf('.')) return
|
||||
if (typeof argv[key] === 'undefined') argv[key] = undefined
|
||||
})
|
||||
}
|
||||
|
||||
function normalizeArgs (args) {
|
||||
if (typeof args === 'string') {
|
||||
return tokenizeArgString(args)
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
singletonify(self)
|
||||
return self
|
||||
}
|
||||
|
||||
// rebase an absolute path to a relative one with respect to a base directory
|
||||
// exported for tests
|
||||
exports.rebase = rebase
|
||||
function rebase (base, dir) {
|
||||
return path.relative(base, dir)
|
||||
const argv = yargs(processArgs, cwd, require)
|
||||
singletonify(argv)
|
||||
return argv
|
||||
}
|
||||
|
||||
/* Hack an instance of Argv with process.argv into Argv
|
||||
@ -655,11 +22,18 @@ function rebase (base, dir) {
|
||||
to get a parsed version of process.argv.
|
||||
*/
|
||||
function singletonify (inst) {
|
||||
Object.keys(inst).forEach(function (key) {
|
||||
Object.keys(inst).forEach((key) => {
|
||||
if (key === 'argv') {
|
||||
Argv.__defineGetter__(key, inst.__lookupGetter__(key))
|
||||
} else if (typeof inst[key] === 'function') {
|
||||
Argv[key] = inst[key].bind(inst)
|
||||
} else {
|
||||
Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]
|
||||
Argv.__defineGetter__('$0', () => {
|
||||
return inst.$0
|
||||
})
|
||||
Argv.__defineGetter__('parsed', () => {
|
||||
return inst.parsed
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
95
node_modules/yargs/lib/completion.js
generated
vendored
95
node_modules/yargs/lib/completion.js
generated
vendored
@ -1,32 +1,36 @@
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
|
||||
// add bash completions to your
|
||||
// yargs-powered applications.
|
||||
module.exports = function (yargs, usage) {
|
||||
var self = {
|
||||
module.exports = function completion (yargs, usage, command) {
|
||||
const self = {
|
||||
completionKey: 'get-yargs-completions'
|
||||
}
|
||||
|
||||
const zshShell = (process.env.SHELL && process.env.SHELL.indexOf('zsh') !== -1) ||
|
||||
(process.env.ZSH_NAME && process.env.ZSH_NAME.indexOf('zsh') !== -1)
|
||||
// get a list of completion commands.
|
||||
self.getCompletion = function (done) {
|
||||
var completions = []
|
||||
var current = process.argv[process.argv.length - 1]
|
||||
var previous = process.argv.slice(process.argv.indexOf('--' + self.completionKey) + 1)
|
||||
var argv = yargs.parse(previous)
|
||||
// 'args' is the array of strings from the line to be completed
|
||||
self.getCompletion = function getCompletion (args, done) {
|
||||
const completions = []
|
||||
const current = args.length ? args[args.length - 1] : ''
|
||||
const argv = yargs.parse(args, true)
|
||||
const aliases = yargs.parsed.aliases
|
||||
const parentCommands = yargs.getContext().commands
|
||||
|
||||
// a custom completion function can be provided
|
||||
// to completion().
|
||||
if (completionFunction) {
|
||||
if (completionFunction.length < 3) {
|
||||
var result = completionFunction(current, argv)
|
||||
const result = completionFunction(current, argv)
|
||||
|
||||
// promise based completion function.
|
||||
if (typeof result.then === 'function') {
|
||||
return result.then(function (list) {
|
||||
process.nextTick(function () { done(list) })
|
||||
}).catch(function (err) {
|
||||
process.nextTick(function () { throw err })
|
||||
return result.then((list) => {
|
||||
process.nextTick(() => { done(list) })
|
||||
}).catch((err) => {
|
||||
process.nextTick(() => { throw err })
|
||||
})
|
||||
}
|
||||
|
||||
@ -34,30 +38,52 @@ module.exports = function (yargs, usage) {
|
||||
return done(result)
|
||||
} else {
|
||||
// asynchronous completion function
|
||||
return completionFunction(current, argv, function (completions) {
|
||||
return completionFunction(current, argv, (completions) => {
|
||||
done(completions)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var handlers = yargs.getCommandHandlers()
|
||||
for (var i = 0, ii = previous.length; i < ii; ++i) {
|
||||
if (handlers[previous[i]]) {
|
||||
return handlers[previous[i]](yargs.reset())
|
||||
const handlers = command.getCommandHandlers()
|
||||
for (let i = 0, ii = args.length; i < ii; ++i) {
|
||||
if (handlers[args[i]] && handlers[args[i]].builder) {
|
||||
const builder = handlers[args[i]].builder
|
||||
if (typeof builder === 'function') {
|
||||
const y = yargs.reset()
|
||||
builder(y)
|
||||
return y.argv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!current.match(/^-/)) {
|
||||
usage.getCommands().forEach(function (command) {
|
||||
if (previous.indexOf(command[0]) === -1) {
|
||||
completions.push(command[0])
|
||||
if (!current.match(/^-/) && parentCommands[parentCommands.length - 1] !== current) {
|
||||
usage.getCommands().forEach((usageCommand) => {
|
||||
const commandName = command.parseCommand(usageCommand[0]).cmd
|
||||
if (args.indexOf(commandName) === -1) {
|
||||
if (!zshShell) {
|
||||
completions.push(commandName)
|
||||
} else {
|
||||
const desc = usageCommand[1] || ''
|
||||
completions.push(commandName.replace(/:/g, '\\:') + ':' + desc)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (current.match(/^-/)) {
|
||||
Object.keys(yargs.getOptions().key).forEach(function (key) {
|
||||
completions.push('--' + key)
|
||||
if (current.match(/^-/) || (current === '' && completions.length === 0)) {
|
||||
const descs = usage.getDescriptions()
|
||||
Object.keys(yargs.getOptions().key).forEach((key) => {
|
||||
// If the key and its aliases aren't in 'args', add the key to 'completions'
|
||||
const keyAndAliases = [key].concat(aliases[key] || [])
|
||||
const notInArgs = keyAndAliases.every(val => args.indexOf(`--${val}`) === -1)
|
||||
if (notInArgs) {
|
||||
if (!zshShell) {
|
||||
completions.push(`--${key}`)
|
||||
} else {
|
||||
const desc = descs[key] || ''
|
||||
completions.push(`--${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -65,25 +91,24 @@ module.exports = function (yargs, usage) {
|
||||
}
|
||||
|
||||
// generate the completion script to add to your .bashrc.
|
||||
self.generateCompletionScript = function ($0) {
|
||||
var script = fs.readFileSync(
|
||||
path.resolve(__dirname, '../completion.sh.hbs'),
|
||||
'utf-8'
|
||||
)
|
||||
var name = path.basename($0)
|
||||
self.generateCompletionScript = function generateCompletionScript ($0, cmd) {
|
||||
const templates = require('./completion-templates')
|
||||
let script = zshShell ? templates.completionZshTemplate : templates.completionShTemplate
|
||||
const name = path.basename($0)
|
||||
|
||||
// add ./to applications not yet installed as bin.
|
||||
if ($0.match(/\.js$/)) $0 = './' + $0
|
||||
if ($0.match(/\.js$/)) $0 = `./${$0}`
|
||||
|
||||
script = script.replace(/{{app_name}}/g, name)
|
||||
script = script.replace(/{{completion_command}}/g, cmd)
|
||||
return script.replace(/{{app_path}}/g, $0)
|
||||
}
|
||||
|
||||
// register a function to perform your own custom
|
||||
// completions., this function can be either
|
||||
// synchrnous or asynchronous.
|
||||
var completionFunction = null
|
||||
self.registerFunction = function (fn) {
|
||||
let completionFunction = null
|
||||
self.registerFunction = (fn) => {
|
||||
completionFunction = fn
|
||||
}
|
||||
|
||||
|
520
node_modules/yargs/lib/parser.js
generated
vendored
520
node_modules/yargs/lib/parser.js
generated
vendored
@ -1,520 +0,0 @@
|
||||
// fancy-pants parsing of argv, originally forked
|
||||
// from minimist: https://www.npmjs.com/package/minimist
|
||||
var camelCase = require('camelcase')
|
||||
var path = require('path')
|
||||
|
||||
function increment (orig) {
|
||||
return orig !== undefined ? orig + 1 : 0
|
||||
}
|
||||
|
||||
module.exports = function (args, opts, y18n) {
|
||||
if (!opts) opts = {}
|
||||
|
||||
var __ = y18n.__
|
||||
var error = null
|
||||
var flags = { arrays: {}, bools: {}, strings: {}, counts: {}, normalize: {}, configs: {}, defaulted: {} }
|
||||
|
||||
;[].concat(opts['array']).filter(Boolean).forEach(function (key) {
|
||||
flags.arrays[key] = true
|
||||
})
|
||||
|
||||
;[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
|
||||
flags.bools[key] = true
|
||||
})
|
||||
|
||||
;[].concat(opts.string).filter(Boolean).forEach(function (key) {
|
||||
flags.strings[key] = true
|
||||
})
|
||||
|
||||
;[].concat(opts.count).filter(Boolean).forEach(function (key) {
|
||||
flags.counts[key] = true
|
||||
})
|
||||
|
||||
;[].concat(opts.normalize).filter(Boolean).forEach(function (key) {
|
||||
flags.normalize[key] = true
|
||||
})
|
||||
|
||||
Object.keys(opts.config).forEach(function (k) {
|
||||
flags.configs[k] = opts.config[k]
|
||||
})
|
||||
|
||||
var aliases = {}
|
||||
var newAliases = {}
|
||||
|
||||
extendAliases(opts.key)
|
||||
extendAliases(opts.alias)
|
||||
extendAliases(opts.default)
|
||||
|
||||
var defaults = opts['default'] || {}
|
||||
Object.keys(defaults).forEach(function (key) {
|
||||
if (/-/.test(key) && !opts.alias[key]) {
|
||||
aliases[key] = aliases[key] || []
|
||||
}
|
||||
(aliases[key] || []).forEach(function (alias) {
|
||||
defaults[alias] = defaults[key]
|
||||
})
|
||||
})
|
||||
|
||||
var argv = { _: [] }
|
||||
|
||||
Object.keys(flags.bools).forEach(function (key) {
|
||||
setArg(key, !(key in defaults) ? false : defaults[key])
|
||||
setDefaulted(key)
|
||||
})
|
||||
|
||||
var notFlags = []
|
||||
if (args.indexOf('--') !== -1) {
|
||||
notFlags = args.slice(args.indexOf('--') + 1)
|
||||
args = args.slice(0, args.indexOf('--'))
|
||||
}
|
||||
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
var arg = args[i]
|
||||
var broken
|
||||
var key
|
||||
var letters
|
||||
var m
|
||||
var next
|
||||
var value
|
||||
|
||||
// -- seperated by =
|
||||
if (arg.match(/^--.+=/)) {
|
||||
// Using [\s\S] instead of . because js doesn't support the
|
||||
// 'dotall' regex modifier. See:
|
||||
// http://stackoverflow.com/a/1068308/13216
|
||||
m = arg.match(/^--([^=]+)=([\s\S]*)$/)
|
||||
|
||||
// nargs format = '--f=monkey washing cat'
|
||||
if (checkAllAliases(m[1], opts.narg)) {
|
||||
args.splice(i + 1, m[1], m[2])
|
||||
i = eatNargs(i, m[1], args)
|
||||
// arrays format = '--f=a b c'
|
||||
} else if (checkAllAliases(m[1], flags.arrays) && args.length > i + 1) {
|
||||
args.splice(i + 1, m[1], m[2])
|
||||
i = eatArray(i, m[1], args)
|
||||
} else {
|
||||
setArg(m[1], m[2])
|
||||
}
|
||||
} else if (arg.match(/^--no-.+/)) {
|
||||
key = arg.match(/^--no-(.+)/)[1]
|
||||
setArg(key, false)
|
||||
|
||||
// -- seperated by space.
|
||||
} else if (arg.match(/^--.+/)) {
|
||||
key = arg.match(/^--(.+)/)[1]
|
||||
|
||||
// nargs format = '--foo a b c'
|
||||
if (checkAllAliases(key, opts.narg)) {
|
||||
i = eatNargs(i, key, args)
|
||||
// array format = '--foo a b c'
|
||||
} else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
|
||||
i = eatArray(i, key, args)
|
||||
} else {
|
||||
next = args[i + 1]
|
||||
|
||||
if (next !== undefined && !next.match(/^-/) &&
|
||||
!checkAllAliases(key, flags.bools) &&
|
||||
!checkAllAliases(key, flags.counts)) {
|
||||
setArg(key, next)
|
||||
i++
|
||||
} else if (/^(true|false)$/.test(next)) {
|
||||
setArg(key, next)
|
||||
i++
|
||||
} else {
|
||||
setArg(key, defaultForType(guessType(key, flags)))
|
||||
}
|
||||
}
|
||||
|
||||
// dot-notation flag seperated by '='.
|
||||
} else if (arg.match(/^-.\..+=/)) {
|
||||
m = arg.match(/^-([^=]+)=([\s\S]*)$/)
|
||||
setArg(m[1], m[2])
|
||||
|
||||
// dot-notation flag seperated by space.
|
||||
} else if (arg.match(/^-.\..+/)) {
|
||||
next = args[i + 1]
|
||||
key = arg.match(/^-(.\..+)/)[1]
|
||||
|
||||
if (next !== undefined && !next.match(/^-/) &&
|
||||
!checkAllAliases(key, flags.bools) &&
|
||||
!checkAllAliases(key, flags.counts)) {
|
||||
setArg(key, next)
|
||||
i++
|
||||
} else {
|
||||
setArg(key, defaultForType(guessType(key, flags)))
|
||||
}
|
||||
} else if (arg.match(/^-[^-]+/)) {
|
||||
letters = arg.slice(1, -1).split('')
|
||||
broken = false
|
||||
|
||||
for (var j = 0; j < letters.length; j++) {
|
||||
next = arg.slice(j + 2)
|
||||
|
||||
if (letters[j + 1] && letters[j + 1] === '=') {
|
||||
value = arg.slice(j + 3)
|
||||
key = letters[j]
|
||||
|
||||
// nargs format = '-f=monkey washing cat'
|
||||
if (checkAllAliases(letters[j], opts.narg)) {
|
||||
args.splice(i + 1, 0, value)
|
||||
i = eatNargs(i, key, args)
|
||||
// array format = '-f=a b c'
|
||||
} else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
|
||||
args.splice(i + 1, 0, value)
|
||||
i = eatArray(i, key, args)
|
||||
} else {
|
||||
setArg(key, value)
|
||||
}
|
||||
|
||||
broken = true
|
||||
break
|
||||
}
|
||||
|
||||
if (next === '-') {
|
||||
setArg(letters[j], next)
|
||||
continue
|
||||
}
|
||||
|
||||
if (/[A-Za-z]/.test(letters[j]) &&
|
||||
/-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
||||
setArg(letters[j], next)
|
||||
broken = true
|
||||
break
|
||||
}
|
||||
|
||||
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
||||
setArg(letters[j], arg.slice(j + 2))
|
||||
broken = true
|
||||
break
|
||||
} else {
|
||||
setArg(letters[j], defaultForType(guessType(letters[j], flags)))
|
||||
}
|
||||
}
|
||||
|
||||
key = arg.slice(-1)[0]
|
||||
|
||||
if (!broken && key !== '-') {
|
||||
// nargs format = '-f a b c'
|
||||
if (checkAllAliases(key, opts.narg)) {
|
||||
i = eatNargs(i, key, args)
|
||||
// array format = '-f a b c'
|
||||
} else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
|
||||
i = eatArray(i, key, args)
|
||||
} else {
|
||||
if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) &&
|
||||
!checkAllAliases(key, flags.bools) &&
|
||||
!checkAllAliases(key, flags.counts)) {
|
||||
setArg(key, args[i + 1])
|
||||
i++
|
||||
} else if (args[i + 1] && /true|false/.test(args[i + 1])) {
|
||||
setArg(key, args[i + 1])
|
||||
i++
|
||||
} else {
|
||||
setArg(key, defaultForType(guessType(key, flags)))
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
argv._.push(
|
||||
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// order of precedence:
|
||||
// 1. command line arg
|
||||
// 2. value from config file
|
||||
// 3. value from env var
|
||||
// 4. configured default value
|
||||
applyEnvVars(opts, argv, true) // special case: check env vars that point to config file
|
||||
setConfig(argv)
|
||||
applyEnvVars(opts, argv, false)
|
||||
applyDefaultsAndAliases(argv, aliases, defaults)
|
||||
|
||||
Object.keys(flags.counts).forEach(function (key) {
|
||||
setArg(key, defaults[key])
|
||||
})
|
||||
|
||||
notFlags.forEach(function (key) {
|
||||
argv._.push(key)
|
||||
})
|
||||
|
||||
// how many arguments should we consume, based
|
||||
// on the nargs option?
|
||||
function eatNargs (i, key, args) {
|
||||
var toEat = checkAllAliases(key, opts.narg)
|
||||
|
||||
if (args.length - (i + 1) < toEat) error = Error(__('Not enough arguments following: %s', key))
|
||||
|
||||
for (var ii = i + 1; ii < (toEat + i + 1); ii++) {
|
||||
setArg(key, args[ii])
|
||||
}
|
||||
|
||||
return (i + toEat)
|
||||
}
|
||||
|
||||
// if an option is an array, eat all non-hyphenated arguments
|
||||
// following it... YUM!
|
||||
// e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
|
||||
function eatArray (i, key, args) {
|
||||
for (var ii = i + 1; ii < args.length; ii++) {
|
||||
if (/^-/.test(args[ii])) break
|
||||
i = ii
|
||||
setArg(key, args[ii])
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
function setArg (key, val) {
|
||||
unsetDefaulted(key)
|
||||
|
||||
// handle parsing boolean arguments --foo=true --bar false.
|
||||
if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
|
||||
if (typeof val === 'string') val = val === 'true'
|
||||
}
|
||||
|
||||
if (/-/.test(key) && !(aliases[key] && aliases[key].length)) {
|
||||
var c = camelCase(key)
|
||||
aliases[key] = [c]
|
||||
newAliases[c] = true
|
||||
}
|
||||
|
||||
var value = !checkAllAliases(key, flags.strings) && isNumber(val) ? Number(val) : val
|
||||
|
||||
if (checkAllAliases(key, flags.counts)) {
|
||||
value = increment
|
||||
}
|
||||
|
||||
var splitKey = key.split('.')
|
||||
setKey(argv, splitKey, value)
|
||||
|
||||
// alias references an inner-value within
|
||||
// a dot-notation object. see #279.
|
||||
if (~key.indexOf('.') && aliases[key]) {
|
||||
aliases[key].forEach(function (x) {
|
||||
x = x.split('.')
|
||||
setKey(argv, x, value)
|
||||
})
|
||||
}
|
||||
|
||||
;(aliases[splitKey[0]] || []).forEach(function (x) {
|
||||
x = x.split('.')
|
||||
|
||||
// handle populating dot notation for both
|
||||
// the key and its aliases.
|
||||
if (splitKey.length > 1) {
|
||||
var a = [].concat(splitKey)
|
||||
a.shift() // nuke the old key.
|
||||
x = x.concat(a)
|
||||
}
|
||||
|
||||
setKey(argv, x, value)
|
||||
})
|
||||
|
||||
var keys = [key].concat(aliases[key] || [])
|
||||
for (var i = 0, l = keys.length; i < l; i++) {
|
||||
if (flags.normalize[keys[i]]) {
|
||||
keys.forEach(function (key) {
|
||||
argv.__defineSetter__(key, function (v) {
|
||||
val = path.normalize(v)
|
||||
})
|
||||
|
||||
argv.__defineGetter__(key, function () {
|
||||
return typeof val === 'string' ? path.normalize(val) : val
|
||||
})
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set args from config.json file, this should be
|
||||
// applied last so that defaults can be applied.
|
||||
function setConfig (argv) {
|
||||
var configLookup = {}
|
||||
|
||||
// expand defaults/aliases, in-case any happen to reference
|
||||
// the config.json file.
|
||||
applyDefaultsAndAliases(configLookup, aliases, defaults)
|
||||
|
||||
Object.keys(flags.configs).forEach(function (configKey) {
|
||||
var configPath = argv[configKey] || configLookup[configKey]
|
||||
if (configPath) {
|
||||
try {
|
||||
var config = null
|
||||
var resolvedConfigPath = path.resolve(process.cwd(), configPath)
|
||||
|
||||
if (typeof flags.configs[configKey] === 'function') {
|
||||
try {
|
||||
config = flags.configs[configKey](resolvedConfigPath)
|
||||
} catch (e) {
|
||||
config = e
|
||||
}
|
||||
if (config instanceof Error) {
|
||||
error = config
|
||||
return
|
||||
}
|
||||
} else {
|
||||
config = require(resolvedConfigPath)
|
||||
}
|
||||
|
||||
Object.keys(config).forEach(function (key) {
|
||||
// setting arguments via CLI takes precedence over
|
||||
// values within the config file.
|
||||
if (argv[key] === undefined || (flags.defaulted[key])) {
|
||||
delete argv[key]
|
||||
setArg(key, config[key])
|
||||
}
|
||||
})
|
||||
} catch (ex) {
|
||||
if (argv[configKey]) error = Error(__('Invalid JSON config file: %s', configPath))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function applyEnvVars (opts, argv, configOnly) {
|
||||
if (typeof opts.envPrefix === 'undefined') return
|
||||
|
||||
var prefix = typeof opts.envPrefix === 'string' ? opts.envPrefix : ''
|
||||
Object.keys(process.env).forEach(function (envVar) {
|
||||
if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) {
|
||||
var key = camelCase(envVar.substring(prefix.length))
|
||||
if (((configOnly && flags.configs[key]) || !configOnly) && (!(key in argv) || flags.defaulted[key])) {
|
||||
setArg(key, process.env[envVar])
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function applyDefaultsAndAliases (obj, aliases, defaults) {
|
||||
Object.keys(defaults).forEach(function (key) {
|
||||
if (!hasKey(obj, key.split('.'))) {
|
||||
setKey(obj, key.split('.'), defaults[key])
|
||||
|
||||
;(aliases[key] || []).forEach(function (x) {
|
||||
if (hasKey(obj, x.split('.'))) return
|
||||
setKey(obj, x.split('.'), defaults[key])
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function hasKey (obj, keys) {
|
||||
var o = obj
|
||||
keys.slice(0, -1).forEach(function (key) {
|
||||
o = (o[key] || {})
|
||||
})
|
||||
|
||||
var key = keys[keys.length - 1]
|
||||
|
||||
if (typeof o !== 'object') return false
|
||||
else return key in o
|
||||
}
|
||||
|
||||
function setKey (obj, keys, value) {
|
||||
var o = obj
|
||||
keys.slice(0, -1).forEach(function (key) {
|
||||
if (o[key] === undefined) o[key] = {}
|
||||
o = o[key]
|
||||
})
|
||||
|
||||
var key = keys[keys.length - 1]
|
||||
if (value === increment) {
|
||||
o[key] = increment(o[key])
|
||||
} else if (o[key] === undefined && checkAllAliases(key, flags.arrays)) {
|
||||
o[key] = Array.isArray(value) ? value : [value]
|
||||
} else if (o[key] === undefined || typeof o[key] === 'boolean') {
|
||||
o[key] = value
|
||||
} else if (Array.isArray(o[key])) {
|
||||
o[key].push(value)
|
||||
} else {
|
||||
o[key] = [ o[key], value ]
|
||||
}
|
||||
}
|
||||
|
||||
// extend the aliases list with inferred aliases.
|
||||
function extendAliases (obj) {
|
||||
Object.keys(obj || {}).forEach(function (key) {
|
||||
// short-circuit if we've already added a key
|
||||
// to the aliases array, for example it might
|
||||
// exist in both 'opts.default' and 'opts.key'.
|
||||
if (aliases[key]) return
|
||||
|
||||
aliases[key] = [].concat(opts.alias[key] || [])
|
||||
// For "--option-name", also set argv.optionName
|
||||
aliases[key].concat(key).forEach(function (x) {
|
||||
if (/-/.test(x)) {
|
||||
var c = camelCase(x)
|
||||
aliases[key].push(c)
|
||||
newAliases[c] = true
|
||||
}
|
||||
})
|
||||
aliases[key].forEach(function (x) {
|
||||
aliases[x] = [key].concat(aliases[key].filter(function (y) {
|
||||
return x !== y
|
||||
}))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check if a flag is set for any of a key's aliases.
|
||||
function checkAllAliases (key, flag) {
|
||||
var isSet = false
|
||||
var toCheck = [].concat(aliases[key] || [], key)
|
||||
|
||||
toCheck.forEach(function (key) {
|
||||
if (flag[key]) isSet = flag[key]
|
||||
})
|
||||
|
||||
return isSet
|
||||
}
|
||||
|
||||
function setDefaulted (key) {
|
||||
[].concat(aliases[key] || [], key).forEach(function (k) {
|
||||
flags.defaulted[k] = true
|
||||
})
|
||||
}
|
||||
|
||||
function unsetDefaulted (key) {
|
||||
[].concat(aliases[key] || [], key).forEach(function (k) {
|
||||
delete flags.defaulted[k]
|
||||
})
|
||||
}
|
||||
|
||||
// return a default value, given the type of a flag.,
|
||||
// e.g., key of type 'string' will default to '', rather than 'true'.
|
||||
function defaultForType (type) {
|
||||
var def = {
|
||||
boolean: true,
|
||||
string: '',
|
||||
array: []
|
||||
}
|
||||
|
||||
return def[type]
|
||||
}
|
||||
|
||||
// given a flag, enforce a default type.
|
||||
function guessType (key, flags) {
|
||||
var type = 'boolean'
|
||||
|
||||
if (flags.strings && flags.strings[key]) type = 'string'
|
||||
else if (flags.arrays && flags.arrays[key]) type = 'array'
|
||||
|
||||
return type
|
||||
}
|
||||
|
||||
function isNumber (x) {
|
||||
if (typeof x === 'number') return true
|
||||
if (/^0x[0-9a-f]+$/i.test(x)) return true
|
||||
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x)
|
||||
}
|
||||
|
||||
return {
|
||||
argv: argv,
|
||||
aliases: aliases,
|
||||
error: error,
|
||||
newAliases: newAliases
|
||||
}
|
||||
}
|
32
node_modules/yargs/lib/tokenize-arg-string.js
generated
vendored
32
node_modules/yargs/lib/tokenize-arg-string.js
generated
vendored
@ -1,32 +0,0 @@
|
||||
// take an un-split argv string and tokenize it.
|
||||
module.exports = function (argString) {
|
||||
var i = 0
|
||||
var c = null
|
||||
var opening = null
|
||||
var args = []
|
||||
|
||||
for (var ii = 0; ii < argString.length; ii++) {
|
||||
c = argString.charAt(ii)
|
||||
|
||||
// split on spaces unless we're in quotes.
|
||||
if (c === ' ' && !opening) {
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
||||
// don't split the string if we're in matching
|
||||
// opening or closing single and double quotes.
|
||||
if (c === opening) {
|
||||
opening = null
|
||||
continue
|
||||
} else if ((c === "'" || c === '"') && !opening) {
|
||||
opening = c
|
||||
continue
|
||||
}
|
||||
|
||||
if (!args[i]) args[i] = ''
|
||||
args[i] += c
|
||||
}
|
||||
|
||||
return args
|
||||
}
|
472
node_modules/yargs/lib/usage.js
generated
vendored
472
node_modules/yargs/lib/usage.js
generated
vendored
@ -1,23 +1,26 @@
|
||||
'use strict'
|
||||
// this file handles outputting usage instructions,
|
||||
// failures, etc. keeps logging in one place.
|
||||
var cliui = require('cliui')
|
||||
var decamelize = require('decamelize')
|
||||
var stringWidth = require('string-width')
|
||||
var wsize = require('window-size')
|
||||
const decamelize = require('decamelize')
|
||||
const stringWidth = require('string-width')
|
||||
const objFilter = require('./obj-filter')
|
||||
const path = require('path')
|
||||
const setBlocking = require('set-blocking')
|
||||
const YError = require('./yerror')
|
||||
|
||||
module.exports = function (yargs, y18n) {
|
||||
var __ = y18n.__
|
||||
var self = {}
|
||||
module.exports = function usage (yargs, y18n) {
|
||||
const __ = y18n.__
|
||||
const self = {}
|
||||
|
||||
// methods for ouputting/building failure message.
|
||||
var fails = []
|
||||
self.failFn = function (f) {
|
||||
const fails = []
|
||||
self.failFn = function failFn (f) {
|
||||
fails.push(f)
|
||||
}
|
||||
|
||||
var failMessage = null
|
||||
var showHelpOnFail = true
|
||||
self.showHelpOnFail = function (enabled, message) {
|
||||
let failMessage = null
|
||||
let showHelpOnFail = true
|
||||
self.showHelpOnFail = function showHelpOnFailFn (enabled, message) {
|
||||
if (typeof enabled === 'string') {
|
||||
message = enabled
|
||||
enabled = true
|
||||
@ -29,104 +32,170 @@ module.exports = function (yargs, y18n) {
|
||||
return self
|
||||
}
|
||||
|
||||
var failureOutput = false
|
||||
self.fail = function (msg) {
|
||||
let failureOutput = false
|
||||
self.fail = function fail (msg, err) {
|
||||
const logger = yargs._getLoggerInstance()
|
||||
|
||||
if (fails.length) {
|
||||
fails.forEach(function (f) {
|
||||
f(msg)
|
||||
})
|
||||
for (let i = fails.length - 1; i >= 0; --i) {
|
||||
fails[i](msg, err, self)
|
||||
}
|
||||
} else {
|
||||
if (yargs.getExitProcess()) setBlocking(true)
|
||||
|
||||
// don't output failure message more than once
|
||||
if (!failureOutput) {
|
||||
failureOutput = true
|
||||
if (showHelpOnFail) yargs.showHelp('error')
|
||||
if (msg) console.error(msg)
|
||||
if (showHelpOnFail) {
|
||||
yargs.showHelp('error')
|
||||
logger.error()
|
||||
}
|
||||
if (msg || err) logger.error(msg || err)
|
||||
if (failMessage) {
|
||||
if (msg) console.error('')
|
||||
console.error(failMessage)
|
||||
if (msg || err) logger.error('')
|
||||
logger.error(failMessage)
|
||||
}
|
||||
}
|
||||
|
||||
err = err || new YError(msg)
|
||||
if (yargs.getExitProcess()) {
|
||||
process.exit(1)
|
||||
return yargs.exit(1)
|
||||
} else if (yargs._hasParseCallback()) {
|
||||
return yargs.exit(1, err)
|
||||
} else {
|
||||
throw new Error(msg)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// methods for ouputting/building help (usage) message.
|
||||
var usage
|
||||
self.usage = function (msg) {
|
||||
usage = msg
|
||||
let usages = []
|
||||
let usageDisabled = false
|
||||
self.usage = (msg, description) => {
|
||||
if (msg === null) {
|
||||
usageDisabled = true
|
||||
usages = []
|
||||
return
|
||||
}
|
||||
usageDisabled = false
|
||||
usages.push([msg, description || ''])
|
||||
return self
|
||||
}
|
||||
self.getUsage = () => {
|
||||
return usages
|
||||
}
|
||||
self.getUsageDisabled = () => {
|
||||
return usageDisabled
|
||||
}
|
||||
|
||||
var examples = []
|
||||
self.example = function (cmd, description) {
|
||||
self.getPositionalGroupName = () => {
|
||||
return __('Positionals:')
|
||||
}
|
||||
|
||||
let examples = []
|
||||
self.example = (cmd, description) => {
|
||||
examples.push([cmd, description || ''])
|
||||
}
|
||||
|
||||
var commands = []
|
||||
self.command = function (cmd, description) {
|
||||
commands.push([cmd, description || ''])
|
||||
}
|
||||
self.getCommands = function () {
|
||||
return commands
|
||||
let commands = []
|
||||
self.command = function command (cmd, description, isDefault, aliases) {
|
||||
// the last default wins, so cancel out any previously set default
|
||||
if (isDefault) {
|
||||
commands = commands.map((cmdArray) => {
|
||||
cmdArray[2] = false
|
||||
return cmdArray
|
||||
})
|
||||
}
|
||||
commands.push([cmd, description || '', isDefault, aliases])
|
||||
}
|
||||
self.getCommands = () => commands
|
||||
|
||||
var descriptions = {}
|
||||
self.describe = function (key, desc) {
|
||||
let descriptions = {}
|
||||
self.describe = function describe (key, desc) {
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach(function (k) {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.describe(k, key[k])
|
||||
})
|
||||
} else {
|
||||
descriptions[key] = desc
|
||||
}
|
||||
}
|
||||
self.getDescriptions = function () {
|
||||
return descriptions
|
||||
self.getDescriptions = () => descriptions
|
||||
|
||||
let epilogs = []
|
||||
self.epilog = (msg) => {
|
||||
epilogs.push(msg)
|
||||
}
|
||||
|
||||
var epilog
|
||||
self.epilog = function (msg) {
|
||||
epilog = msg
|
||||
}
|
||||
|
||||
var wrap = windowWidth()
|
||||
self.wrap = function (cols) {
|
||||
let wrapSet = false
|
||||
let wrap
|
||||
self.wrap = (cols) => {
|
||||
wrapSet = true
|
||||
wrap = cols
|
||||
}
|
||||
|
||||
var deferY18nLookupPrefix = '__yargsString__:'
|
||||
self.deferY18nLookup = function (str) {
|
||||
return deferY18nLookupPrefix + str
|
||||
function getWrap () {
|
||||
if (!wrapSet) {
|
||||
wrap = windowWidth()
|
||||
wrapSet = true
|
||||
}
|
||||
|
||||
return wrap
|
||||
}
|
||||
|
||||
var defaultGroup = 'Options:'
|
||||
self.help = function () {
|
||||
const deferY18nLookupPrefix = '__yargsString__:'
|
||||
self.deferY18nLookup = str => deferY18nLookupPrefix + str
|
||||
|
||||
const defaultGroup = 'Options:'
|
||||
self.help = function help () {
|
||||
if (cachedHelpMessage) return cachedHelpMessage
|
||||
normalizeAliases()
|
||||
|
||||
var demanded = yargs.getDemanded()
|
||||
var groups = yargs.getGroups()
|
||||
var options = yargs.getOptions()
|
||||
var keys = Object.keys(
|
||||
Object.keys(descriptions)
|
||||
.concat(Object.keys(demanded))
|
||||
.concat(Object.keys(options.default))
|
||||
.reduce(function (acc, key) {
|
||||
if (key !== '_') acc[key] = true
|
||||
return acc
|
||||
}, {})
|
||||
)
|
||||
var ui = cliui({
|
||||
width: wrap,
|
||||
wrap: !!wrap
|
||||
// handle old demanded API
|
||||
const base$0 = yargs.customScriptName ? yargs.$0 : path.basename(yargs.$0)
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
const demandedCommands = yargs.getDemandedCommands()
|
||||
const groups = yargs.getGroups()
|
||||
const options = yargs.getOptions()
|
||||
|
||||
let keys = []
|
||||
keys = keys.concat(Object.keys(descriptions))
|
||||
keys = keys.concat(Object.keys(demandedOptions))
|
||||
keys = keys.concat(Object.keys(demandedCommands))
|
||||
keys = keys.concat(Object.keys(options.default))
|
||||
keys = keys.filter(filterHiddenOptions)
|
||||
keys = Object.keys(keys.reduce((acc, key) => {
|
||||
if (key !== '_') acc[key] = true
|
||||
return acc
|
||||
}, {}))
|
||||
|
||||
const theWrap = getWrap()
|
||||
const ui = require('cliui')({
|
||||
width: theWrap,
|
||||
wrap: !!theWrap
|
||||
})
|
||||
|
||||
// the usage string.
|
||||
if (usage) {
|
||||
var u = usage.replace(/\$0/g, yargs.$0)
|
||||
ui.div(u + '\n')
|
||||
if (!usageDisabled) {
|
||||
if (usages.length) {
|
||||
// user-defined usage.
|
||||
usages.forEach((usage) => {
|
||||
ui.div(`${usage[0].replace(/\$0/g, base$0)}`)
|
||||
if (usage[1]) {
|
||||
ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] })
|
||||
}
|
||||
})
|
||||
ui.div()
|
||||
} else if (commands.length) {
|
||||
let u = null
|
||||
// demonstrate how commands are used.
|
||||
if (demandedCommands._) {
|
||||
u = `${base$0} <${__('command')}>\n`
|
||||
} else {
|
||||
u = `${base$0} [${__('command')}]\n`
|
||||
}
|
||||
ui.div(`${u}`)
|
||||
}
|
||||
}
|
||||
|
||||
// your application's commands, i.e., non-option
|
||||
@ -134,11 +203,33 @@ module.exports = function (yargs, y18n) {
|
||||
if (commands.length) {
|
||||
ui.div(__('Commands:'))
|
||||
|
||||
commands.forEach(function (command) {
|
||||
ui.div(
|
||||
{text: command[0], padding: [0, 2, 0, 2], width: maxWidth(commands) + 4},
|
||||
{text: command[1]}
|
||||
const context = yargs.getContext()
|
||||
const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : ''
|
||||
|
||||
if (yargs.getParserConfiguration()['sort-commands'] === true) {
|
||||
commands = commands.sort((a, b) => a[0].localeCompare(b[0]))
|
||||
}
|
||||
|
||||
commands.forEach((command) => {
|
||||
const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}` // drop $0 from default commands.
|
||||
ui.span(
|
||||
{
|
||||
text: commandString,
|
||||
padding: [0, 2, 0, 2],
|
||||
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
|
||||
},
|
||||
{ text: command[1] }
|
||||
)
|
||||
const hints = []
|
||||
if (command[2]) hints.push(`[${__('default:').slice(0, -1)}]`) // TODO hacking around i18n here
|
||||
if (command[3] && command[3].length) {
|
||||
hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`)
|
||||
}
|
||||
if (hints.length) {
|
||||
ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' })
|
||||
} else {
|
||||
ui.div()
|
||||
}
|
||||
})
|
||||
|
||||
ui.div()
|
||||
@ -146,14 +237,10 @@ module.exports = function (yargs, y18n) {
|
||||
|
||||
// perform some cleanup on the keys array, making it
|
||||
// only include top-level keys not their aliases.
|
||||
var aliasKeys = (Object.keys(options.alias) || [])
|
||||
const aliasKeys = (Object.keys(options.alias) || [])
|
||||
.concat(Object.keys(yargs.parsed.newAliases) || [])
|
||||
|
||||
keys = keys.filter(function (key) {
|
||||
return !yargs.parsed.newAliases[key] && aliasKeys.every(function (alias) {
|
||||
return (options.alias[alias] || []).indexOf(key) === -1
|
||||
})
|
||||
})
|
||||
keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1))
|
||||
|
||||
// populate 'Options:' group with any keys that have not
|
||||
// explicitly had a group set.
|
||||
@ -161,59 +248,65 @@ module.exports = function (yargs, y18n) {
|
||||
addUngroupedKeys(keys, options.alias, groups)
|
||||
|
||||
// display 'Options:' table along with any custom tables:
|
||||
Object.keys(groups).forEach(function (groupName) {
|
||||
Object.keys(groups).forEach((groupName) => {
|
||||
if (!groups[groupName].length) return
|
||||
|
||||
ui.div(__(groupName))
|
||||
|
||||
// if we've grouped the key 'f', but 'f' aliases 'foobar',
|
||||
// normalizedKeys should contain only 'foobar'.
|
||||
var normalizedKeys = groups[groupName].map(function (key) {
|
||||
const normalizedKeys = groups[groupName].filter(filterHiddenOptions).map((key) => {
|
||||
if (~aliasKeys.indexOf(key)) return key
|
||||
for (var i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
|
||||
for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
|
||||
if (~(options.alias[aliasKey] || []).indexOf(key)) return aliasKey
|
||||
}
|
||||
return key
|
||||
})
|
||||
|
||||
if (normalizedKeys.length < 1) return
|
||||
|
||||
ui.div(__(groupName))
|
||||
|
||||
// actually generate the switches string --foo, -f, --bar.
|
||||
var switches = normalizedKeys.reduce(function (acc, key) {
|
||||
const switches = normalizedKeys.reduce((acc, key) => {
|
||||
acc[key] = [ key ].concat(options.alias[key] || [])
|
||||
.map(function (sw) {
|
||||
return (sw.length > 1 ? '--' : '-') + sw
|
||||
.map(sw => {
|
||||
// for the special positional group don't
|
||||
// add '--' or '-' prefix.
|
||||
if (groupName === self.getPositionalGroupName()) return sw
|
||||
else return (sw.length > 1 ? '--' : '-') + sw
|
||||
})
|
||||
.join(', ')
|
||||
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
normalizedKeys.forEach(function (key) {
|
||||
var kswitch = switches[key]
|
||||
var desc = descriptions[key] || ''
|
||||
var type = null
|
||||
normalizedKeys.forEach((key) => {
|
||||
const kswitch = switches[key]
|
||||
let desc = descriptions[key] || ''
|
||||
let type = null
|
||||
|
||||
if (~desc.lastIndexOf(deferY18nLookupPrefix)) desc = __(desc.substring(deferY18nLookupPrefix.length))
|
||||
|
||||
if (~options.boolean.indexOf(key)) type = '[' + __('boolean') + ']'
|
||||
if (~options.count.indexOf(key)) type = '[' + __('count') + ']'
|
||||
if (~options.string.indexOf(key)) type = '[' + __('string') + ']'
|
||||
if (~options.normalize.indexOf(key)) type = '[' + __('string') + ']'
|
||||
if (~options.array.indexOf(key)) type = '[' + __('array') + ']'
|
||||
if (~options.boolean.indexOf(key)) type = `[${__('boolean')}]`
|
||||
if (~options.count.indexOf(key)) type = `[${__('count')}]`
|
||||
if (~options.string.indexOf(key)) type = `[${__('string')}]`
|
||||
if (~options.normalize.indexOf(key)) type = `[${__('string')}]`
|
||||
if (~options.array.indexOf(key)) type = `[${__('array')}]`
|
||||
if (~options.number.indexOf(key)) type = `[${__('number')}]`
|
||||
|
||||
var extra = [
|
||||
const extra = [
|
||||
type,
|
||||
demanded[key] ? '[' + __('required') + ']' : null,
|
||||
options.choices && options.choices[key] ? '[' + __('choices:') + ' ' +
|
||||
self.stringifiedValues(options.choices[key]) + ']' : null,
|
||||
(key in demandedOptions) ? `[${__('required')}]` : null,
|
||||
options.choices && options.choices[key] ? `[${__('choices:')} ${
|
||||
self.stringifiedValues(options.choices[key])}]` : null,
|
||||
defaultString(options.default[key], options.defaultDescription[key])
|
||||
].filter(Boolean).join(' ')
|
||||
|
||||
ui.span(
|
||||
{text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches) + 4},
|
||||
{ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 },
|
||||
desc
|
||||
)
|
||||
|
||||
if (extra) ui.div({text: extra, padding: [0, 0, 0, 2], align: 'right'})
|
||||
if (extra) ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' })
|
||||
else ui.div()
|
||||
})
|
||||
|
||||
@ -224,49 +317,65 @@ module.exports = function (yargs, y18n) {
|
||||
if (examples.length) {
|
||||
ui.div(__('Examples:'))
|
||||
|
||||
examples.forEach(function (example) {
|
||||
example[0] = example[0].replace(/\$0/g, yargs.$0)
|
||||
examples.forEach((example) => {
|
||||
example[0] = example[0].replace(/\$0/g, base$0)
|
||||
})
|
||||
|
||||
examples.forEach(function (example) {
|
||||
ui.div(
|
||||
{text: example[0], padding: [0, 2, 0, 2], width: maxWidth(examples) + 4},
|
||||
example[1]
|
||||
)
|
||||
examples.forEach((example) => {
|
||||
if (example[1] === '') {
|
||||
ui.div(
|
||||
{
|
||||
text: example[0],
|
||||
padding: [0, 2, 0, 2]
|
||||
}
|
||||
)
|
||||
} else {
|
||||
ui.div(
|
||||
{
|
||||
text: example[0],
|
||||
padding: [0, 2, 0, 2],
|
||||
width: maxWidth(examples, theWrap) + 4
|
||||
}, {
|
||||
text: example[1]
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
ui.div()
|
||||
}
|
||||
|
||||
// the usage string.
|
||||
if (epilog) {
|
||||
var e = epilog.replace(/\$0/g, yargs.$0)
|
||||
ui.div(e + '\n')
|
||||
if (epilogs.length > 0) {
|
||||
const e = epilogs.map(epilog => epilog.replace(/\$0/g, base$0)).join('\n')
|
||||
ui.div(`${e}\n`)
|
||||
}
|
||||
|
||||
return ui.toString()
|
||||
// Remove the trailing white spaces
|
||||
return ui.toString().replace(/\s*$/, '')
|
||||
}
|
||||
|
||||
// return the maximum width of a string
|
||||
// in the left-hand column of a table.
|
||||
function maxWidth (table) {
|
||||
var width = 0
|
||||
function maxWidth (table, theWrap, modifier) {
|
||||
let width = 0
|
||||
|
||||
// table might be of the form [leftColumn],
|
||||
// or {key: leftColumn}}
|
||||
// or {key: leftColumn}
|
||||
if (!Array.isArray(table)) {
|
||||
table = Object.keys(table).map(function (key) {
|
||||
return [table[key]]
|
||||
})
|
||||
table = Object.keys(table).map(key => [table[key]])
|
||||
}
|
||||
|
||||
table.forEach(function (v) {
|
||||
width = Math.max(stringWidth(v[0]), width)
|
||||
table.forEach((v) => {
|
||||
width = Math.max(
|
||||
stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]),
|
||||
width
|
||||
)
|
||||
})
|
||||
|
||||
// if we've enabled 'wrap' we should limit
|
||||
// the max-width of the left-column.
|
||||
if (wrap) width = Math.min(width, parseInt(wrap * 0.5, 10))
|
||||
if (theWrap) width = Math.min(width, parseInt(theWrap * 0.5, 10))
|
||||
|
||||
return width
|
||||
}
|
||||
@ -274,63 +383,76 @@ module.exports = function (yargs, y18n) {
|
||||
// make sure any options set for aliases,
|
||||
// are copied to the keys being aliased.
|
||||
function normalizeAliases () {
|
||||
var demanded = yargs.getDemanded()
|
||||
var options = yargs.getOptions()
|
||||
// handle old demanded API
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
const options = yargs.getOptions()
|
||||
|
||||
;(Object.keys(options.alias) || []).forEach(function (key) {
|
||||
options.alias[key].forEach(function (alias) {
|
||||
;(Object.keys(options.alias) || []).forEach((key) => {
|
||||
options.alias[key].forEach((alias) => {
|
||||
// copy descriptions.
|
||||
if (descriptions[alias]) self.describe(key, descriptions[alias])
|
||||
// copy demanded.
|
||||
if (demanded[alias]) yargs.demand(key, demanded[alias].msg)
|
||||
if (alias in demandedOptions) yargs.demandOption(key, demandedOptions[alias])
|
||||
// type messages.
|
||||
if (~options.boolean.indexOf(alias)) yargs.boolean(key)
|
||||
if (~options.count.indexOf(alias)) yargs.count(key)
|
||||
if (~options.string.indexOf(alias)) yargs.string(key)
|
||||
if (~options.normalize.indexOf(alias)) yargs.normalize(key)
|
||||
if (~options.array.indexOf(alias)) yargs.array(key)
|
||||
if (~options.number.indexOf(alias)) yargs.number(key)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// if yargs is executing an async handler, we take a snapshot of the
|
||||
// help message to display on failure:
|
||||
let cachedHelpMessage
|
||||
self.cacheHelpMessage = function () {
|
||||
cachedHelpMessage = this.help()
|
||||
}
|
||||
|
||||
// given a set of keys, place any keys that are
|
||||
// ungrouped under the 'Options:' grouping.
|
||||
function addUngroupedKeys (keys, aliases, groups) {
|
||||
var groupedKeys = []
|
||||
var toCheck = null
|
||||
Object.keys(groups).forEach(function (group) {
|
||||
let groupedKeys = []
|
||||
let toCheck = null
|
||||
Object.keys(groups).forEach((group) => {
|
||||
groupedKeys = groupedKeys.concat(groups[group])
|
||||
})
|
||||
|
||||
keys.forEach(function (key) {
|
||||
keys.forEach((key) => {
|
||||
toCheck = [key].concat(aliases[key])
|
||||
if (!toCheck.some(function (k) {
|
||||
return groupedKeys.indexOf(k) !== -1
|
||||
})) {
|
||||
if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
|
||||
groups[defaultGroup].push(key)
|
||||
}
|
||||
})
|
||||
return groupedKeys
|
||||
}
|
||||
|
||||
self.showHelp = function (level) {
|
||||
level = level || 'error'
|
||||
console[level](self.help())
|
||||
function filterHiddenOptions (key) {
|
||||
return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt]
|
||||
}
|
||||
|
||||
self.functionDescription = function (fn) {
|
||||
var description = fn.name ? decamelize(fn.name, '-') : __('generated-value')
|
||||
self.showHelp = (level) => {
|
||||
const logger = yargs._getLoggerInstance()
|
||||
if (!level) level = 'error'
|
||||
const emit = typeof level === 'function' ? level : logger[level]
|
||||
emit(self.help())
|
||||
}
|
||||
|
||||
self.functionDescription = (fn) => {
|
||||
const description = fn.name ? decamelize(fn.name, '-') : __('generated-value')
|
||||
return ['(', description, ')'].join('')
|
||||
}
|
||||
|
||||
self.stringifiedValues = function (values, separator) {
|
||||
var string = ''
|
||||
var sep = separator || ', '
|
||||
var array = [].concat(values)
|
||||
self.stringifiedValues = function stringifiedValues (values, separator) {
|
||||
let string = ''
|
||||
const sep = separator || ', '
|
||||
const array = [].concat(values)
|
||||
|
||||
if (!values || !array.length) return string
|
||||
|
||||
array.forEach(function (value) {
|
||||
array.forEach((value) => {
|
||||
if (string.length) string += sep
|
||||
string += JSON.stringify(value)
|
||||
})
|
||||
@ -341,7 +463,7 @@ module.exports = function (yargs, y18n) {
|
||||
// format the default-value-string displayed in
|
||||
// the right-hand column.
|
||||
function defaultString (value, defaultDescription) {
|
||||
var string = '[' + __('default:') + ' '
|
||||
let string = `[${__('default:')} `
|
||||
|
||||
if (value === undefined && !defaultDescription) return null
|
||||
|
||||
@ -350,7 +472,7 @@ module.exports = function (yargs, y18n) {
|
||||
} else {
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
string += JSON.stringify(value)
|
||||
string += `"${value}"`
|
||||
break
|
||||
case 'object':
|
||||
string += JSON.stringify(value)
|
||||
@ -360,23 +482,67 @@ module.exports = function (yargs, y18n) {
|
||||
}
|
||||
}
|
||||
|
||||
return string + ']'
|
||||
return `${string}]`
|
||||
}
|
||||
|
||||
// guess the width of the console window, max-width 80.
|
||||
function windowWidth () {
|
||||
return wsize.width ? Math.min(80, wsize.width) : null
|
||||
const maxWidth = 80
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||
return Math.min(maxWidth, process.stdout.columns)
|
||||
} else {
|
||||
return maxWidth
|
||||
}
|
||||
}
|
||||
|
||||
// logic for displaying application version.
|
||||
var version = null
|
||||
self.version = function (ver, opt, msg) {
|
||||
let version = null
|
||||
self.version = (ver) => {
|
||||
version = ver
|
||||
}
|
||||
|
||||
self.showVersion = function () {
|
||||
if (typeof version === 'function') console.log(version())
|
||||
else console.log(version)
|
||||
self.showVersion = () => {
|
||||
const logger = yargs._getLoggerInstance()
|
||||
logger.log(version)
|
||||
}
|
||||
|
||||
self.reset = function reset (localLookup) {
|
||||
// do not reset wrap here
|
||||
// do not reset fails here
|
||||
failMessage = null
|
||||
failureOutput = false
|
||||
usages = []
|
||||
usageDisabled = false
|
||||
epilogs = []
|
||||
examples = []
|
||||
commands = []
|
||||
descriptions = objFilter(descriptions, (k, v) => !localLookup[k])
|
||||
return self
|
||||
}
|
||||
|
||||
let frozens = []
|
||||
self.freeze = function freeze () {
|
||||
let frozen = {}
|
||||
frozens.push(frozen)
|
||||
frozen.failMessage = failMessage
|
||||
frozen.failureOutput = failureOutput
|
||||
frozen.usages = usages
|
||||
frozen.usageDisabled = usageDisabled
|
||||
frozen.epilogs = epilogs
|
||||
frozen.examples = examples
|
||||
frozen.commands = commands
|
||||
frozen.descriptions = descriptions
|
||||
}
|
||||
self.unfreeze = function unfreeze () {
|
||||
let frozen = frozens.pop()
|
||||
failMessage = frozen.failMessage
|
||||
failureOutput = frozen.failureOutput
|
||||
usages = frozen.usages
|
||||
usageDisabled = frozen.usageDisabled
|
||||
epilogs = frozen.epilogs
|
||||
examples = frozen.examples
|
||||
commands = frozen.commands
|
||||
descriptions = frozen.descriptions
|
||||
}
|
||||
|
||||
return self
|
||||
|
383
node_modules/yargs/lib/validation.js
generated
vendored
383
node_modules/yargs/lib/validation.js
generated
vendored
@ -1,85 +1,81 @@
|
||||
'use strict'
|
||||
const argsert = require('./argsert')
|
||||
const objFilter = require('./obj-filter')
|
||||
const specialKeys = ['$0', '--', '_']
|
||||
|
||||
// validation-type-stuff, missing params,
|
||||
// bad implications, custom checks.
|
||||
module.exports = function (yargs, usage, y18n) {
|
||||
var __ = y18n.__
|
||||
var __n = y18n.__n
|
||||
var self = {}
|
||||
module.exports = function validation (yargs, usage, y18n) {
|
||||
const __ = y18n.__
|
||||
const __n = y18n.__n
|
||||
const self = {}
|
||||
|
||||
// validate appropriate # of non-option
|
||||
// arguments were provided, i.e., '_'.
|
||||
self.nonOptionCount = function (argv) {
|
||||
var demanded = yargs.getDemanded()
|
||||
var _s = argv._.length
|
||||
self.nonOptionCount = function nonOptionCount (argv) {
|
||||
const demandedCommands = yargs.getDemandedCommands()
|
||||
// don't count currently executing commands
|
||||
const _s = argv._.length - yargs.getContext().commands.length
|
||||
|
||||
if (demanded._ && (_s < demanded._.count || _s > demanded._.max)) {
|
||||
if (demanded._.msg !== undefined) {
|
||||
usage.fail(demanded._.msg)
|
||||
} else if (_s < demanded._.count) {
|
||||
usage.fail(
|
||||
__('Not enough non-option arguments: got %s, need at least %s', argv._.length, demanded._.count)
|
||||
)
|
||||
} else {
|
||||
usage.fail(
|
||||
__('Too many non-option arguments: got %s, maximum of %s', argv._.length, demanded._.max)
|
||||
)
|
||||
if (demandedCommands._ && (_s < demandedCommands._.min || _s > demandedCommands._.max)) {
|
||||
if (_s < demandedCommands._.min) {
|
||||
if (demandedCommands._.minMsg !== undefined) {
|
||||
usage.fail(
|
||||
// replace $0 with observed, $1 with expected.
|
||||
demandedCommands._.minMsg ? demandedCommands._.minMsg.replace(/\$0/g, _s).replace(/\$1/, demandedCommands._.min) : null
|
||||
)
|
||||
} else {
|
||||
usage.fail(
|
||||
__('Not enough non-option arguments: got %s, need at least %s', _s, demandedCommands._.min)
|
||||
)
|
||||
}
|
||||
} else if (_s > demandedCommands._.max) {
|
||||
if (demandedCommands._.maxMsg !== undefined) {
|
||||
usage.fail(
|
||||
// replace $0 with observed, $1 with expected.
|
||||
demandedCommands._.maxMsg ? demandedCommands._.maxMsg.replace(/\$0/g, _s).replace(/\$1/, demandedCommands._.max) : null
|
||||
)
|
||||
} else {
|
||||
usage.fail(
|
||||
__('Too many non-option arguments: got %s, maximum of %s', _s, demandedCommands._.max)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that any args that require an
|
||||
// value (--foo=bar), have a value.
|
||||
self.missingArgumentValue = function (argv) {
|
||||
var defaultValues = [true, false, '']
|
||||
var options = yargs.getOptions()
|
||||
|
||||
if (options.requiresArg.length > 0) {
|
||||
var missingRequiredArgs = []
|
||||
|
||||
options.requiresArg.forEach(function (key) {
|
||||
var value = argv[key]
|
||||
|
||||
// if a value is explicitly requested,
|
||||
// flag argument as missing if it does not
|
||||
// look like foo=bar was entered.
|
||||
if (~defaultValues.indexOf(value) ||
|
||||
(Array.isArray(value) && !value.length)) {
|
||||
missingRequiredArgs.push(key)
|
||||
}
|
||||
})
|
||||
|
||||
if (missingRequiredArgs.length > 0) {
|
||||
usage.fail(__n(
|
||||
'Missing argument value: %s',
|
||||
'Missing argument values: %s',
|
||||
missingRequiredArgs.length,
|
||||
missingRequiredArgs.join(', ')
|
||||
))
|
||||
}
|
||||
// validate the appropriate # of <required>
|
||||
// positional arguments were provided:
|
||||
self.positionalCount = function positionalCount (required, observed) {
|
||||
if (observed < required) {
|
||||
usage.fail(
|
||||
__('Not enough non-option arguments: got %s, need at least %s', observed, required)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// make sure all the required arguments are present.
|
||||
self.requiredArguments = function (argv) {
|
||||
var demanded = yargs.getDemanded()
|
||||
var missing = null
|
||||
self.requiredArguments = function requiredArguments (argv) {
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
let missing = null
|
||||
|
||||
Object.keys(demanded).forEach(function (key) {
|
||||
if (!argv.hasOwnProperty(key)) {
|
||||
Object.keys(demandedOptions).forEach((key) => {
|
||||
if (!argv.hasOwnProperty(key) || typeof argv[key] === 'undefined') {
|
||||
missing = missing || {}
|
||||
missing[key] = demanded[key]
|
||||
missing[key] = demandedOptions[key]
|
||||
}
|
||||
})
|
||||
|
||||
if (missing) {
|
||||
var customMsgs = []
|
||||
Object.keys(missing).forEach(function (key) {
|
||||
var msg = missing[key].msg
|
||||
const customMsgs = []
|
||||
Object.keys(missing).forEach((key) => {
|
||||
const msg = missing[key]
|
||||
if (msg && customMsgs.indexOf(msg) < 0) {
|
||||
customMsgs.push(msg)
|
||||
}
|
||||
})
|
||||
|
||||
var customMsg = customMsgs.length ? '\n' + customMsgs.join('\n') : ''
|
||||
const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : ''
|
||||
|
||||
usage.fail(__n(
|
||||
'Missing required argument: %s',
|
||||
@ -91,27 +87,29 @@ module.exports = function (yargs, usage, y18n) {
|
||||
}
|
||||
|
||||
// check for unknown arguments (strict-mode).
|
||||
self.unknownArguments = function (argv, aliases) {
|
||||
var aliasLookup = {}
|
||||
var descriptions = usage.getDescriptions()
|
||||
var demanded = yargs.getDemanded()
|
||||
var unknown = []
|
||||
self.unknownArguments = function unknownArguments (argv, aliases, positionalMap) {
|
||||
const commandKeys = yargs.getCommandInstance().getCommands()
|
||||
const unknown = []
|
||||
const currentContext = yargs.getContext()
|
||||
|
||||
Object.keys(aliases).forEach(function (key) {
|
||||
aliases[key].forEach(function (alias) {
|
||||
aliasLookup[alias] = key
|
||||
})
|
||||
})
|
||||
|
||||
Object.keys(argv).forEach(function (key) {
|
||||
if (key !== '$0' && key !== '_' &&
|
||||
!descriptions.hasOwnProperty(key) &&
|
||||
!demanded.hasOwnProperty(key) &&
|
||||
!aliasLookup.hasOwnProperty(key)) {
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (specialKeys.indexOf(key) === -1 &&
|
||||
!positionalMap.hasOwnProperty(key) &&
|
||||
!yargs._getParseContext().hasOwnProperty(key) &&
|
||||
!self.isValidAndSomeAliasIsNotNew(key, aliases)
|
||||
) {
|
||||
unknown.push(key)
|
||||
}
|
||||
})
|
||||
|
||||
if ((currentContext.commands.length > 0) || (commandKeys.length > 0)) {
|
||||
argv._.slice(currentContext.commands.length).forEach((key) => {
|
||||
if (commandKeys.indexOf(key) === -1) {
|
||||
unknown.push(key)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (unknown.length > 0) {
|
||||
usage.fail(__n(
|
||||
'Unknown argument: %s',
|
||||
@ -122,128 +120,231 @@ module.exports = function (yargs, usage, y18n) {
|
||||
}
|
||||
}
|
||||
|
||||
// check for a key that is not an alias, or for which every alias is new,
|
||||
// implying that it was invented by the parser, e.g., during camelization
|
||||
self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew (key, aliases) {
|
||||
if (!aliases.hasOwnProperty(key)) {
|
||||
return false
|
||||
}
|
||||
const newAliases = yargs.parsed.newAliases
|
||||
for (let a of [key, ...aliases[key]]) {
|
||||
if (!newAliases.hasOwnProperty(a) || !newAliases[key]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// validate arguments limited to enumerated choices
|
||||
self.limitedChoices = function (argv) {
|
||||
var options = yargs.getOptions()
|
||||
var invalid = {}
|
||||
self.limitedChoices = function limitedChoices (argv) {
|
||||
const options = yargs.getOptions()
|
||||
const invalid = {}
|
||||
|
||||
if (!Object.keys(options.choices).length) return
|
||||
|
||||
Object.keys(argv).forEach(function (key) {
|
||||
if (key !== '$0' && key !== '_' &&
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (specialKeys.indexOf(key) === -1 &&
|
||||
options.choices.hasOwnProperty(key)) {
|
||||
[].concat(argv[key]).forEach(function (value) {
|
||||
[].concat(argv[key]).forEach((value) => {
|
||||
// TODO case-insensitive configurability
|
||||
if (options.choices[key].indexOf(value) === -1) {
|
||||
if (options.choices[key].indexOf(value) === -1 &&
|
||||
value !== undefined) {
|
||||
invalid[key] = (invalid[key] || []).concat(value)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
var invalidKeys = Object.keys(invalid)
|
||||
const invalidKeys = Object.keys(invalid)
|
||||
|
||||
if (!invalidKeys.length) return
|
||||
|
||||
var msg = __('Invalid values:')
|
||||
invalidKeys.forEach(function (key) {
|
||||
msg += '\n ' + __(
|
||||
let msg = __('Invalid values:')
|
||||
invalidKeys.forEach((key) => {
|
||||
msg += `\n ${__(
|
||||
'Argument: %s, Given: %s, Choices: %s',
|
||||
key,
|
||||
usage.stringifiedValues(invalid[key]),
|
||||
usage.stringifiedValues(options.choices[key])
|
||||
)
|
||||
)}`
|
||||
})
|
||||
usage.fail(msg)
|
||||
}
|
||||
|
||||
// custom checks, added using the `check` option on yargs.
|
||||
var checks = []
|
||||
self.check = function (f) {
|
||||
checks.push(f)
|
||||
let checks = []
|
||||
self.check = function check (f, global) {
|
||||
checks.push({
|
||||
func: f,
|
||||
global
|
||||
})
|
||||
}
|
||||
|
||||
self.customChecks = function (argv, aliases) {
|
||||
checks.forEach(function (f) {
|
||||
self.customChecks = function customChecks (argv, aliases) {
|
||||
for (let i = 0, f; (f = checks[i]) !== undefined; i++) {
|
||||
const func = f.func
|
||||
let result = null
|
||||
try {
|
||||
var result = f(argv, aliases)
|
||||
if (!result) {
|
||||
usage.fail(__('Argument check failed: %s', f.toString()))
|
||||
} else if (typeof result === 'string') {
|
||||
usage.fail(result)
|
||||
}
|
||||
result = func(argv, aliases)
|
||||
} catch (err) {
|
||||
usage.fail(err.message ? err.message : err)
|
||||
usage.fail(err.message ? err.message : err, err)
|
||||
continue
|
||||
}
|
||||
})
|
||||
|
||||
if (!result) {
|
||||
usage.fail(__('Argument check failed: %s', func.toString()))
|
||||
} else if (typeof result === 'string' || result instanceof Error) {
|
||||
usage.fail(result.toString(), result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check implications, argument foo implies => argument bar.
|
||||
var implied = {}
|
||||
self.implies = function (key, value) {
|
||||
let implied = {}
|
||||
self.implies = function implies (key, value) {
|
||||
argsert('<string|object> [array|number|string]', [key, value], arguments.length)
|
||||
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach(function (k) {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.implies(k, key[k])
|
||||
})
|
||||
} else {
|
||||
implied[key] = value
|
||||
yargs.global(key)
|
||||
if (!implied[key]) {
|
||||
implied[key] = []
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((i) => self.implies(key, i))
|
||||
} else {
|
||||
implied[key].push(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.getImplied = function () {
|
||||
self.getImplied = function getImplied () {
|
||||
return implied
|
||||
}
|
||||
|
||||
self.implications = function (argv) {
|
||||
var implyFail = []
|
||||
function keyExists (argv, val) {
|
||||
// convert string '1' to number 1
|
||||
let num = Number(val)
|
||||
val = isNaN(num) ? val : num
|
||||
|
||||
Object.keys(implied).forEach(function (key) {
|
||||
var num
|
||||
var origKey = key
|
||||
var value = implied[key]
|
||||
if (typeof val === 'number') {
|
||||
// check length of argv._
|
||||
val = argv._.length >= val
|
||||
} else if (val.match(/^--no-.+/)) {
|
||||
// check if key/value doesn't exist
|
||||
val = val.match(/^--no-(.+)/)[1]
|
||||
val = !argv[val]
|
||||
} else {
|
||||
// check if key/value exists
|
||||
val = argv[val]
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
// convert string '1' to number 1
|
||||
num = Number(key)
|
||||
key = isNaN(num) ? key : num
|
||||
self.implications = function implications (argv) {
|
||||
const implyFail = []
|
||||
|
||||
if (typeof key === 'number') {
|
||||
// check length of argv._
|
||||
key = argv._.length >= key
|
||||
} else if (key.match(/^--no-.+/)) {
|
||||
// check if key doesn't exist
|
||||
key = key.match(/^--no-(.+)/)[1]
|
||||
key = !argv[key]
|
||||
} else {
|
||||
// check if key exists
|
||||
key = argv[key]
|
||||
}
|
||||
Object.keys(implied).forEach((key) => {
|
||||
const origKey = key
|
||||
;(implied[key] || []).forEach((value) => {
|
||||
let key = origKey
|
||||
const origValue = value
|
||||
key = keyExists(argv, key)
|
||||
value = keyExists(argv, value)
|
||||
|
||||
num = Number(value)
|
||||
value = isNaN(num) ? value : num
|
||||
|
||||
if (typeof value === 'number') {
|
||||
value = argv._.length >= value
|
||||
} else if (value.match(/^--no-.+/)) {
|
||||
value = value.match(/^--no-(.+)/)[1]
|
||||
value = !argv[value]
|
||||
} else {
|
||||
value = argv[value]
|
||||
}
|
||||
|
||||
if (key && !value) {
|
||||
implyFail.push(origKey)
|
||||
}
|
||||
if (key && !value) {
|
||||
implyFail.push(` ${origKey} -> ${origValue}`)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
if (implyFail.length) {
|
||||
var msg = __('Implications failed:') + '\n'
|
||||
let msg = `${__('Implications failed:')}\n`
|
||||
|
||||
implyFail.forEach(function (key) {
|
||||
msg += (' ' + key + ' -> ' + implied[key])
|
||||
implyFail.forEach((value) => {
|
||||
msg += (value)
|
||||
})
|
||||
|
||||
usage.fail(msg)
|
||||
}
|
||||
}
|
||||
|
||||
let conflicting = {}
|
||||
self.conflicts = function conflicts (key, value) {
|
||||
argsert('<string|object> [array|string]', [key, value], arguments.length)
|
||||
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.conflicts(k, key[k])
|
||||
})
|
||||
} else {
|
||||
yargs.global(key)
|
||||
if (!conflicting[key]) {
|
||||
conflicting[key] = []
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((i) => self.conflicts(key, i))
|
||||
} else {
|
||||
conflicting[key].push(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.getConflicting = () => conflicting
|
||||
|
||||
self.conflicting = function conflictingFn (argv) {
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (conflicting[key]) {
|
||||
conflicting[key].forEach((value) => {
|
||||
// we default keys to 'undefined' that have been configured, we should not
|
||||
// apply conflicting check unless they are a value other than 'undefined'.
|
||||
if (value && argv[key] !== undefined && argv[value] !== undefined) {
|
||||
usage.fail(__('Arguments %s and %s are mutually exclusive', key, value))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
self.recommendCommands = function recommendCommands (cmd, potentialCommands) {
|
||||
const distance = require('./levenshtein')
|
||||
const threshold = 3 // if it takes more than three edits, let's move on.
|
||||
potentialCommands = potentialCommands.sort((a, b) => b.length - a.length)
|
||||
|
||||
let recommended = null
|
||||
let bestDistance = Infinity
|
||||
for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) {
|
||||
const d = distance(cmd, candidate)
|
||||
if (d <= threshold && d < bestDistance) {
|
||||
bestDistance = d
|
||||
recommended = candidate
|
||||
}
|
||||
}
|
||||
if (recommended) usage.fail(__('Did you mean %s?', recommended))
|
||||
}
|
||||
|
||||
self.reset = function reset (localLookup) {
|
||||
implied = objFilter(implied, (k, v) => !localLookup[k])
|
||||
conflicting = objFilter(conflicting, (k, v) => !localLookup[k])
|
||||
checks = checks.filter(c => c.global)
|
||||
return self
|
||||
}
|
||||
|
||||
let frozens = []
|
||||
self.freeze = function freeze () {
|
||||
let frozen = {}
|
||||
frozens.push(frozen)
|
||||
frozen.implied = implied
|
||||
frozen.checks = checks
|
||||
frozen.conflicting = conflicting
|
||||
}
|
||||
self.unfreeze = function unfreeze () {
|
||||
let frozen = frozens.pop()
|
||||
implied = frozen.implied
|
||||
checks = frozen.checks
|
||||
conflicting = frozen.conflicting
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
|
7
node_modules/yargs/locales/de.json
generated
vendored
7
node_modules/yargs/locales/de.json
generated
vendored
@ -5,10 +5,12 @@
|
||||
"boolean": "boolean",
|
||||
"count": "Zähler",
|
||||
"string": "string",
|
||||
"number": "Zahl",
|
||||
"array": "array",
|
||||
"required": "erforderlich",
|
||||
"default:": "Standard:",
|
||||
"choices:": "Möglichkeiten:",
|
||||
"aliases:": "Aliase:",
|
||||
"generated-value": "Generierter-Wert",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt",
|
||||
@ -27,10 +29,11 @@
|
||||
"Invalid values:": "Unzulässige Werte:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeben: %s, Möglichkeiten: %s",
|
||||
"Argument check failed: %s": "Argumente-Check fehlgeschlagen: %s",
|
||||
"Implications failed:": "Implikationen fehlgeschlagen:",
|
||||
"Implications failed:": "Fehlende abhängige Argumente:",
|
||||
"Not enough arguments following: %s": "Nicht genügend Argumente nach: %s",
|
||||
"Invalid JSON config file: %s": "Fehlerhafte JSON-Config Datei: %s",
|
||||
"Path to JSON config file": "Pfad zur JSON-Config Datei",
|
||||
"Show help": "Hilfe anzeigen",
|
||||
"Show version number": "Version anzeigen"
|
||||
"Show version number": "Version anzeigen",
|
||||
"Did you mean %s?": "Meintest du %s?"
|
||||
}
|
||||
|
10
node_modules/yargs/locales/en.json
generated
vendored
10
node_modules/yargs/locales/en.json
generated
vendored
@ -5,10 +5,12 @@
|
||||
"boolean": "boolean",
|
||||
"count": "count",
|
||||
"string": "string",
|
||||
"number": "number",
|
||||
"array": "array",
|
||||
"required": "required",
|
||||
"default:": "default:",
|
||||
"choices:": "choices:",
|
||||
"aliases:": "aliases:",
|
||||
"generated-value": "generated-value",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Not enough non-option arguments: got %s, need at least %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Too many non-option arguments: got %s, maximum of %s",
|
||||
@ -27,10 +29,14 @@
|
||||
"Invalid values:": "Invalid values:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s",
|
||||
"Argument check failed: %s": "Argument check failed: %s",
|
||||
"Implications failed:": "Implications failed:",
|
||||
"Implications failed:": "Missing dependent arguments:",
|
||||
"Not enough arguments following: %s": "Not enough arguments following: %s",
|
||||
"Invalid JSON config file: %s": "Invalid JSON config file: %s",
|
||||
"Path to JSON config file": "Path to JSON config file",
|
||||
"Show help": "Show help",
|
||||
"Show version number": "Show version number"
|
||||
"Show version number": "Show version number",
|
||||
"Did you mean %s?": "Did you mean %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive",
|
||||
"Positionals:": "Positionals:",
|
||||
"command": "command"
|
||||
}
|
||||
|
15
node_modules/yargs/locales/es.json
generated
vendored
15
node_modules/yargs/locales/es.json
generated
vendored
@ -2,13 +2,15 @@
|
||||
"Commands:": "Comandos:",
|
||||
"Options:": "Opciones:",
|
||||
"Examples:": "Ejemplos:",
|
||||
"boolean": "boolean",
|
||||
"boolean": "booleano",
|
||||
"count": "cuenta",
|
||||
"string": "cadena de caracteres",
|
||||
"number": "número",
|
||||
"array": "tabla",
|
||||
"required": "requisito",
|
||||
"required": "requerido",
|
||||
"default:": "defecto:",
|
||||
"choices:": "selección:",
|
||||
"aliases:": "alias:",
|
||||
"generated-value": "valor-generado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s",
|
||||
@ -25,12 +27,13 @@
|
||||
"other": "Argumentos desconocidos: %s"
|
||||
},
|
||||
"Invalid values:": "Valores inválidos:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Selección: %s",
|
||||
"Argument check failed: %s": "Verificación de argumento ha fracasado: %s",
|
||||
"Implications failed:": "Implicaciones fracasadas:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Seleccionados: %s",
|
||||
"Argument check failed: %s": "Verificación de argumento ha fallado: %s",
|
||||
"Implications failed:": "Implicaciones fallidas:",
|
||||
"Not enough arguments following: %s": "No hay suficientes argumentos después de: %s",
|
||||
"Invalid JSON config file: %s": "Archivo de configuración JSON inválido: %s",
|
||||
"Path to JSON config file": "Ruta al archivo de configuración JSON",
|
||||
"Show help": "Muestra ayuda",
|
||||
"Show version number": "Muestra número de versión"
|
||||
"Show version number": "Muestra número de versión",
|
||||
"Did you mean %s?": "Quisiste decir %s?"
|
||||
}
|
||||
|
3
node_modules/yargs/locales/fr.json
generated
vendored
3
node_modules/yargs/locales/fr.json
generated
vendored
@ -5,6 +5,7 @@
|
||||
"boolean": "booléen",
|
||||
"count": "comptage",
|
||||
"string": "chaine de caractère",
|
||||
"number": "nombre",
|
||||
"array": "tableau",
|
||||
"required": "requis",
|
||||
"default:": "défaut:",
|
||||
@ -27,7 +28,7 @@
|
||||
"Invalid values:": "Valeurs invalides:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Donné: %s, Choix: %s",
|
||||
"Argument check failed: %s": "Echec de la vérification de l'argument: %s",
|
||||
"Implications failed:": "Implications échouées:",
|
||||
"Implications failed:": "Arguments dépendants manquants:",
|
||||
"Not enough arguments following: %s": "Pas assez d'arguments suivant: %s",
|
||||
"Invalid JSON config file: %s": "Fichier de configuration JSON invalide: %s",
|
||||
"Path to JSON config file": "Chemin du fichier de configuration JSON",
|
||||
|
8
node_modules/yargs/locales/id.json
generated
vendored
8
node_modules/yargs/locales/id.json
generated
vendored
@ -5,10 +5,12 @@
|
||||
"Examples:": "Contoh:",
|
||||
"boolean": "boolean",
|
||||
"count": "jumlah",
|
||||
"number": "nomor",
|
||||
"string": "string",
|
||||
"array": "larik",
|
||||
"required": "diperlukan",
|
||||
"default:": "bawaan:",
|
||||
"aliases:": "istilah lain:",
|
||||
"choices:": "pilihan:",
|
||||
"generated-value": "nilai-yang-dihasilkan",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Argumen wajib kurang: hanya %s, minimal %s",
|
||||
@ -33,5 +35,9 @@
|
||||
"Invalid JSON config file: %s": "Berkas konfigurasi JSON tidak valid: %s",
|
||||
"Path to JSON config file": "Alamat berkas konfigurasi JSON",
|
||||
"Show help": "Lihat bantuan",
|
||||
"Show version number": "Lihat nomor versi"
|
||||
"Show version number": "Lihat nomor versi",
|
||||
"Did you mean %s?": "Maksud Anda: %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumen %s dan %s saling eksklusif",
|
||||
"Positionals:": "Posisional-posisional:",
|
||||
"command": "perintah"
|
||||
}
|
||||
|
8
node_modules/yargs/locales/ja.json
generated
vendored
8
node_modules/yargs/locales/ja.json
generated
vendored
@ -5,10 +5,12 @@
|
||||
"boolean": "真偽",
|
||||
"count": "カウント",
|
||||
"string": "文字列",
|
||||
"number": "数値",
|
||||
"array": "配列",
|
||||
"required": "必須",
|
||||
"default:": "デフォルト:",
|
||||
"choices:": "選択してください:",
|
||||
"aliases:": "エイリアス:",
|
||||
"generated-value": "生成された値",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:",
|
||||
@ -32,5 +34,9 @@
|
||||
"Invalid JSON config file: %s": "JSONの設定ファイルが不正です: %s",
|
||||
"Path to JSON config file": "JSONの設定ファイルまでのpath",
|
||||
"Show help": "ヘルプを表示",
|
||||
"Show version number": "バージョンを表示"
|
||||
"Show version number": "バージョンを表示",
|
||||
"Did you mean %s?": "もしかして %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "引数 %s と %s は同時に指定できません",
|
||||
"Positionals:": "位置:",
|
||||
"command": "コマンド"
|
||||
}
|
||||
|
8
node_modules/yargs/locales/ko.json
generated
vendored
8
node_modules/yargs/locales/ko.json
generated
vendored
@ -5,10 +5,12 @@
|
||||
"boolean": "여부",
|
||||
"count": "개수",
|
||||
"string": "문자열",
|
||||
"number": "숫자",
|
||||
"array": "배열",
|
||||
"required": "필수",
|
||||
"default:": "기본:",
|
||||
"choices:": "선택:",
|
||||
"aliases:": "별칭:",
|
||||
"generated-value": "생성된 값",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다",
|
||||
@ -32,5 +34,9 @@
|
||||
"Invalid JSON config file: %s": "유효하지 않은 JSON 설정파일입니다: %s",
|
||||
"Path to JSON config file": "JSON 설정파일 경로",
|
||||
"Show help": "도움말을 보여줍니다",
|
||||
"Show version number": "버전 넘버를 보여줍니다"
|
||||
"Show version number": "버전 넘버를 보여줍니다",
|
||||
"Did you mean %s?": "찾고계신게 %s입니까?",
|
||||
"Arguments %s and %s are mutually exclusive" : "%s와 %s 인자는 같이 사용될 수 없습니다",
|
||||
"Positionals:": "위치:",
|
||||
"command": "명령"
|
||||
}
|
||||
|
3
node_modules/yargs/locales/nb.json
generated
vendored
3
node_modules/yargs/locales/nb.json
generated
vendored
@ -5,6 +5,7 @@
|
||||
"boolean": "boolsk",
|
||||
"count": "antall",
|
||||
"string": "streng",
|
||||
"number": "nummer",
|
||||
"array": "matrise",
|
||||
"required": "obligatorisk",
|
||||
"default:": "standard:",
|
||||
@ -26,7 +27,7 @@
|
||||
},
|
||||
"Invalid values:": "Ugyldige verdier:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gitt: %s, Valg: %s",
|
||||
"Argument check failed: %s": "Argument sjekk mislyktes: %s",
|
||||
"Argument check failed: %s": "Argumentsjekk mislyktes: %s",
|
||||
"Implications failed:": "Konsekvensene mislyktes:",
|
||||
"Not enough arguments following: %s": "Ikke nok følgende argumenter: %s",
|
||||
"Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s",
|
||||
|
3
node_modules/yargs/locales/pirate.json
generated
vendored
3
node_modules/yargs/locales/pirate.json
generated
vendored
@ -8,5 +8,6 @@
|
||||
"other": "Ye be havin' to set the followin' arguments land lubber: %s"
|
||||
},
|
||||
"Show help": "Parlay this here code of conduct",
|
||||
"Show version number": "'Tis the version ye be askin' fer"
|
||||
"Show version number": "'Tis the version ye be askin' fer",
|
||||
"Arguments %s and %s are mutually exclusive" : "Yon scurvy dogs %s and %s be as bad as rum and a prudish wench"
|
||||
}
|
||||
|
8
node_modules/yargs/locales/pl.json
generated
vendored
8
node_modules/yargs/locales/pl.json
generated
vendored
@ -5,10 +5,12 @@
|
||||
"boolean": "boolean",
|
||||
"count": "ilość",
|
||||
"string": "ciąg znaków",
|
||||
"number": "liczba",
|
||||
"array": "tablica",
|
||||
"required": "wymagany",
|
||||
"default:": "domyślny:",
|
||||
"choices:": "dostępne:",
|
||||
"aliases:": "aliasy:",
|
||||
"generated-value": "wygenerowana-wartość",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s",
|
||||
@ -32,5 +34,9 @@
|
||||
"Invalid JSON config file: %s": "Nieprawidłowy plik konfiguracyjny JSON: %s",
|
||||
"Path to JSON config file": "Ścieżka do pliku konfiguracyjnego JSON",
|
||||
"Show help": "Pokaż pomoc",
|
||||
"Show version number": "Pokaż numer wersji"
|
||||
"Show version number": "Pokaż numer wersji",
|
||||
"Did you mean %s?": "Czy chodziło Ci o %s?",
|
||||
"Arguments %s and %s are mutually exclusive": "Argumenty %s i %s wzajemnie się wykluczają",
|
||||
"Positionals:": "Pozycyjne:",
|
||||
"command": "polecenie"
|
||||
}
|
||||
|
4
node_modules/yargs/locales/pt.json
generated
vendored
4
node_modules/yargs/locales/pt.json
generated
vendored
@ -5,6 +5,7 @@
|
||||
"boolean": "boolean",
|
||||
"count": "contagem",
|
||||
"string": "cadeia de caracteres",
|
||||
"number": "número",
|
||||
"array": "arranjo",
|
||||
"required": "requerido",
|
||||
"default:": "padrão:",
|
||||
@ -32,5 +33,6 @@
|
||||
"Invalid JSON config file: %s": "Arquivo de configuração em JSON esta inválido: %s",
|
||||
"Path to JSON config file": "Caminho para o arquivo de configuração em JSON",
|
||||
"Show help": "Mostra ajuda",
|
||||
"Show version number": "Mostra número de versão"
|
||||
"Show version number": "Mostra número de versão",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos"
|
||||
}
|
||||
|
10
node_modules/yargs/locales/pt_BR.json
generated
vendored
10
node_modules/yargs/locales/pt_BR.json
generated
vendored
@ -2,13 +2,15 @@
|
||||
"Commands:": "Comandos:",
|
||||
"Options:": "Opções:",
|
||||
"Examples:": "Exemplos:",
|
||||
"boolean": "boolean",
|
||||
"boolean": "booleano",
|
||||
"count": "contagem",
|
||||
"string": "string",
|
||||
"number": "número",
|
||||
"array": "array",
|
||||
"required": "obrigatório",
|
||||
"default:": "padrão:",
|
||||
"choices:": "opções:",
|
||||
"aliases:": "sinônimos:",
|
||||
"generated-value": "valor-gerado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Excesso de argumentos: recebido %s, máximo de %s",
|
||||
@ -32,5 +34,9 @@
|
||||
"Invalid JSON config file: %s": "Arquivo JSON de configuração inválido: %s",
|
||||
"Path to JSON config file": "Caminho para o arquivo JSON de configuração",
|
||||
"Show help": "Exibe ajuda",
|
||||
"Show version number": "Exibe a versão"
|
||||
"Show version number": "Exibe a versão",
|
||||
"Did you mean %s?": "Você quis dizer %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos",
|
||||
"Positionals:": "Posicionais:",
|
||||
"command": "comando"
|
||||
}
|
||||
|
7
node_modules/yargs/locales/tr.json
generated
vendored
7
node_modules/yargs/locales/tr.json
generated
vendored
@ -5,10 +5,12 @@
|
||||
"boolean": "boolean",
|
||||
"count": "sayı",
|
||||
"string": "string",
|
||||
"number": "numara",
|
||||
"array": "array",
|
||||
"required": "zorunlu",
|
||||
"default:": "varsayılan:",
|
||||
"choices:": "seçimler:",
|
||||
"aliases:": "takma adlar:",
|
||||
"generated-value": "oluşturulan-değer",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s",
|
||||
@ -32,5 +34,8 @@
|
||||
"Invalid JSON config file: %s": "Geçersiz JSON yapılandırma dosyası: %s",
|
||||
"Path to JSON config file": "JSON yapılandırma dosya konumu",
|
||||
"Show help": "Yardım detaylarını göster",
|
||||
"Show version number": "Versiyon detaylarını göster"
|
||||
"Show version number": "Versiyon detaylarını göster",
|
||||
"Did you mean %s?": "Bunu mu demek istediniz: %s?",
|
||||
"Positionals:": "Sıralılar:",
|
||||
"command": "komut"
|
||||
}
|
||||
|
36
node_modules/yargs/locales/zh.json
generated
vendored
36
node_modules/yargs/locales/zh.json
generated
vendored
@ -1,36 +0,0 @@
|
||||
{
|
||||
"Commands:": "命令:",
|
||||
"Options:": "选项:",
|
||||
"Examples:": "示例:",
|
||||
"boolean": "boolean",
|
||||
"count": "count",
|
||||
"string": "string",
|
||||
"array": "array",
|
||||
"required": "required",
|
||||
"default:": "默认值:",
|
||||
"choices:": "可选值:",
|
||||
"generated-value": "生成的值",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个",
|
||||
"Missing argument value: %s": {
|
||||
"one": "没有给此选项指定值:%s",
|
||||
"other": "没有给这些选项指定值:%s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "缺少必须的选项:%s",
|
||||
"other": "缺少这些必须的选项:%s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "无法识别的选项:%s",
|
||||
"other": "无法识别这些选项:%s"
|
||||
},
|
||||
"Invalid values:": "无效的选项值:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "选项名称: %s, 传入的值: %s, 可选的值:%s",
|
||||
"Argument check failed: %s": "选项值验证失败:%s",
|
||||
"Implications failed:": "缺少依赖的选项:",
|
||||
"Not enough arguments following: %s": "没有提供足够的值给此选项:%s",
|
||||
"Invalid JSON config file: %s": "无效的 JSON 配置文件:%s",
|
||||
"Path to JSON config file": "JSON 配置文件的路径",
|
||||
"Show help": "显示帮助信息",
|
||||
"Show version number": "显示版本号"
|
||||
}
|
121
node_modules/yargs/package.json
generated
vendored
121
node_modules/yargs/package.json
generated
vendored
@ -1,103 +1,82 @@
|
||||
{
|
||||
"_from": "yargs@^3.10.0",
|
||||
"_id": "yargs@3.32.0",
|
||||
"_from": "yargs",
|
||||
"_id": "yargs@14.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=",
|
||||
"_integrity": "sha512-/is78VKbKs70bVZH7w4YaZea6xcJWOAwkhbR0CFuZBmYtfTYF0xjGJF43AYd8g2Uii1yJwmS5GR2vBmrc32sbg==",
|
||||
"_location": "/yargs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "yargs@^3.10.0",
|
||||
"raw": "yargs",
|
||||
"name": "yargs",
|
||||
"escapedName": "yargs",
|
||||
"rawSpec": "^3.10.0",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.10.0"
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/protobufjs"
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz",
|
||||
"_shasum": "03088e9ebf9e756b69751611d2a5ef591482c995",
|
||||
"_spec": "yargs@^3.10.0",
|
||||
"_where": "/home/sergiu/linx-audio-simulator/node_modules/protobufjs",
|
||||
"author": {
|
||||
"name": "Alex Ford",
|
||||
"email": "Alex.Ford@CodeTunnel.com",
|
||||
"url": "http://CodeTunnel.com"
|
||||
},
|
||||
"_resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.0.tgz",
|
||||
"_shasum": "f116a9242c4ed8668790b40759b4906c276e76c3",
|
||||
"_spec": "yargs",
|
||||
"_where": "/home/sergiu/linx-simulator2",
|
||||
"bugs": {
|
||||
"url": "https://github.com/bcoe/yargs/issues"
|
||||
"url": "https://github.com/yargs/yargs/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Benjamin Coe",
|
||||
"email": "ben@npmjs.com",
|
||||
"url": "https://github.com/bcoe"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Goode",
|
||||
"url": "https://github.com/nexdrew"
|
||||
},
|
||||
{
|
||||
"name": "Chris Needham",
|
||||
"email": "chris@chrisneedham.com",
|
||||
"url": "http://chrisneedham.com"
|
||||
},
|
||||
{
|
||||
"name": "James Nylen",
|
||||
"email": "jnylen@gmail.com",
|
||||
"url": "https://github.com/nylen"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Horsleben",
|
||||
"url": "https://github.com/fizker"
|
||||
},
|
||||
{
|
||||
"name": "Lin Clark",
|
||||
"url": "https://github.com/linclark"
|
||||
},
|
||||
{
|
||||
"name": "Tim Schaub",
|
||||
"url": "https://github.com/tschaub"
|
||||
"name": "Yargs Contributors",
|
||||
"url": "https://github.com/yargs/yargs/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"camelcase": "^2.0.1",
|
||||
"cliui": "^3.0.3",
|
||||
"decamelize": "^1.1.1",
|
||||
"os-locale": "^1.4.0",
|
||||
"string-width": "^1.0.1",
|
||||
"window-size": "^0.1.4",
|
||||
"y18n": "^3.2.0"
|
||||
"cliui": "^5.0.0",
|
||||
"decamelize": "^1.2.0",
|
||||
"find-up": "^3.0.0",
|
||||
"get-caller-file": "^2.0.1",
|
||||
"require-directory": "^2.1.1",
|
||||
"require-main-filename": "^2.0.0",
|
||||
"set-blocking": "^2.0.0",
|
||||
"string-width": "^3.0.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^4.0.0",
|
||||
"yargs-parser": "^15.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Light-weight option parsing with an argv hash. No optstrings attached.",
|
||||
"description": "yargs the modern, pirate-themed, successor to optimist.",
|
||||
"devDependencies": {
|
||||
"chai": "^3.4.1",
|
||||
"chalk": "^1.1.1",
|
||||
"coveralls": "^2.11.4",
|
||||
"es6-promise": "^3.0.2",
|
||||
"chai": "^4.2.0",
|
||||
"chalk": "^2.4.2",
|
||||
"coveralls": "^3.0.3",
|
||||
"cpr": "^3.0.1",
|
||||
"cross-spawn": "^6.0.4",
|
||||
"es6-promise": "^4.2.5",
|
||||
"hashish": "0.0.4",
|
||||
"mocha": "^2.3.4",
|
||||
"nyc": "^5.2.0",
|
||||
"standard": "^5.4.1",
|
||||
"which": "^1.1.2",
|
||||
"win-spawn": "^2.0.0"
|
||||
"mocha": "^5.2.0",
|
||||
"nyc": "^14.1.0",
|
||||
"rimraf": "^2.6.3",
|
||||
"standard": "^12.0.1",
|
||||
"standard-version": "^7.0.0",
|
||||
"which": "^1.3.1",
|
||||
"yargs-test-extends": "^1.0.1"
|
||||
},
|
||||
"engine": {
|
||||
"node": ">=0.10"
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"yargs.js",
|
||||
"lib",
|
||||
"locales",
|
||||
"completion.sh.hbs",
|
||||
"completion.zsh.hbs",
|
||||
"LICENSE"
|
||||
],
|
||||
"homepage": "https://github.com/bcoe/yargs#readme",
|
||||
"homepage": "https://yargs.js.org/",
|
||||
"keywords": [
|
||||
"argument",
|
||||
"args",
|
||||
@ -112,20 +91,18 @@
|
||||
"name": "yargs",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/bcoe/yargs.git"
|
||||
"url": "git+https://github.com/yargs/yargs.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||
"pretest": "standard",
|
||||
"test": "nyc --cache mocha --timeout=4000 --check-leaks"
|
||||
"release": "standard-version",
|
||||
"test": "nyc --cache mocha --require ./test/before.js --timeout=12000 --check-leaks"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"**/example/**"
|
||||
],
|
||||
"globals": [
|
||||
"it"
|
||||
]
|
||||
},
|
||||
"version": "3.32.0"
|
||||
"version": "14.2.0"
|
||||
}
|
||||
|
Reference in New Issue
Block a user