yargs 16.0.2 → 16.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -295
- package/README.md +27 -8
- package/browser.mjs +4 -4
- package/build/index.cjs +378 -238
- package/build/lib/argsert.js +9 -5
- package/build/lib/command.js +45 -37
- package/build/lib/completion.js +27 -14
- package/build/lib/middleware.js +5 -3
- package/build/lib/parse-command.js +3 -3
- package/build/lib/usage.js +81 -47
- package/build/lib/utils/apply-extends.js +8 -7
- package/build/lib/utils/is-promise.js +2 -2
- package/build/lib/utils/obj-filter.js +1 -1
- package/build/lib/utils/set-blocking.js +4 -2
- package/build/lib/utils/which-module.js +1 -1
- package/build/lib/validation.js +39 -32
- package/build/lib/yargs-factory.js +153 -87
- package/helpers/helpers.mjs +10 -0
- package/helpers/index.js +14 -0
- package/helpers/package.json +3 -0
- package/index.cjs +17 -17
- package/index.mjs +5 -5
- package/lib/platform-shims/browser.mjs +38 -37
- package/package.json +35 -27
- package/{yargs.cjs → yargs} +3 -2
- package/helpers.mjs +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -2,339 +2,76 @@
|
|
|
2
2
|
|
|
3
3
|
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.
|
|
4
4
|
|
|
5
|
-
### [16.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
* **typescript:** yargs-parser was breaking @types/yargs ([#1745](https://www.github.com/yargs/yargs/issues/1745)) ([2253284](https://www.github.com/yargs/yargs/commit/2253284b233cceabd8db677b81c5bf1755eef230))
|
|
11
|
-
|
|
12
|
-
### [16.0.1](https://www.github.com/yargs/yargs/compare/v16.0.0...v16.0.1) (2020-09-09)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Bug Fixes
|
|
16
|
-
|
|
17
|
-
* code was not passed to process.exit ([#1742](https://www.github.com/yargs/yargs/issues/1742)) ([d1a9930](https://www.github.com/yargs/yargs/commit/d1a993035a2f76c138460052cf19425f9684b637))
|
|
18
|
-
|
|
19
|
-
## [16.0.0](https://www.github.com/yargs/yargs/compare/v15.4.2...v16.0.0) (2020-09-09)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### ⚠ BREAKING CHANGES
|
|
23
|
-
|
|
24
|
-
* tweaks to ESM/Deno API surface: now exports yargs function by default; getProcessArgvWithoutBin becomes hideBin; types now exported for Deno.
|
|
25
|
-
* find-up replaced with escalade; export map added (limits importable files in Node >= 12); yarser-parser@19.x.x (new decamelize/camelcase implementation).
|
|
26
|
-
* **usage:** single character aliases are now shown first in help output
|
|
27
|
-
* rebase helper is no longer provided on yargs instance.
|
|
28
|
-
* drop support for EOL Node 8 (#1686)
|
|
29
|
-
|
|
30
|
-
### Features
|
|
31
|
-
|
|
32
|
-
* adds strictOptions() ([#1738](https://www.github.com/yargs/yargs/issues/1738)) ([b215fba](https://www.github.com/yargs/yargs/commit/b215fba0ed6e124e5aad6cf22c8d5875661c63a3))
|
|
33
|
-
* **helpers:** rebase, Parser, applyExtends now blessed helpers ([#1733](https://www.github.com/yargs/yargs/issues/1733)) ([c7debe8](https://www.github.com/yargs/yargs/commit/c7debe8eb1e5bc6ea20b5ed68026c56e5ebec9e1))
|
|
34
|
-
* adds support for ESM and Deno ([#1708](https://www.github.com/yargs/yargs/issues/1708)) ([ac6d5d1](https://www.github.com/yargs/yargs/commit/ac6d5d105a75711fe703f6a39dad5181b383d6c6))
|
|
35
|
-
* drop support for EOL Node 8 ([#1686](https://www.github.com/yargs/yargs/issues/1686)) ([863937f](https://www.github.com/yargs/yargs/commit/863937f23c3102f804cdea78ee3097e28c7c289f))
|
|
36
|
-
* i18n for ESM and Deno ([#1735](https://www.github.com/yargs/yargs/issues/1735)) ([c71783a](https://www.github.com/yargs/yargs/commit/c71783a5a898a0c0e92ac501c939a3ec411ac0c1))
|
|
37
|
-
* tweaks to API surface based on user feedback ([#1726](https://www.github.com/yargs/yargs/issues/1726)) ([4151fee](https://www.github.com/yargs/yargs/commit/4151fee4c33a97d26bc40de7e623e5b0eb87e9bb))
|
|
38
|
-
* **usage:** single char aliases first in help ([#1574](https://www.github.com/yargs/yargs/issues/1574)) ([a552990](https://www.github.com/yargs/yargs/commit/a552990c120646c2d85a5c9b628e1ce92a68e797))
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Bug Fixes
|
|
42
|
-
|
|
43
|
-
* **yargs:** add missing command(module) signature ([#1707](https://www.github.com/yargs/yargs/issues/1707)) ([0f81024](https://www.github.com/yargs/yargs/commit/0f810245494ccf13a35b7786d021b30fc95ecad5)), closes [#1704](https://www.github.com/yargs/yargs/issues/1704)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## [15.4.0](https://www.github.com/yargs/yargs/compare/v15.3.1...v15.4.0) (2020-06-30)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### Features
|
|
50
|
-
|
|
51
|
-
* adds deprecation option for commands ([027a636](https://www.github.com/yargs/yargs/commit/027a6365b737e13116811a8ef43670196e1fa00a))
|
|
52
|
-
* support array of examples ([#1682](https://www.github.com/yargs/yargs/issues/1682)) ([225ab82](https://www.github.com/yargs/yargs/commit/225ab8271938bed3a48d23175f3d580ce8cd1306))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### Bug Fixes
|
|
56
|
-
|
|
57
|
-
* **docs:** describe usage of `.check()` in more detail ([932cd11](https://www.github.com/yargs/yargs/commit/932cd1177e93f5cc99edfe57a4028e30717bf8fb))
|
|
58
|
-
* **i18n:** Japanese translation phrasing ([#1619](https://www.github.com/yargs/yargs/issues/1619)) ([0894175](https://www.github.com/yargs/yargs/commit/089417550ef5a5b8ce3578dd2a989191300b64cd))
|
|
59
|
-
* **strict mode:** report default command unknown arguments ([#1626](https://www.github.com/yargs/yargs/issues/1626)) ([69f29a9](https://www.github.com/yargs/yargs/commit/69f29a9cd429d4bb99481238305390107ac75b02))
|
|
60
|
-
* **usage:** translate 'options' group only when displaying help ([#1600](https://www.github.com/yargs/yargs/issues/1600)) ([e60b39b](https://www.github.com/yargs/yargs/commit/e60b39b9d3a912c06db43f87c86ba894142b6c1c))
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
### Reverts
|
|
64
|
-
|
|
65
|
-
* Revert "chore(deps): update dependency eslint to v7 (#1656)" (#1673) ([34949f8](https://www.github.com/yargs/yargs/commit/34949f89ee7cdf88f7b315659df4b5f62f714842)), closes [#1656](https://www.github.com/yargs/yargs/issues/1656) [#1673](https://www.github.com/yargs/yargs/issues/1673)
|
|
66
|
-
|
|
67
|
-
### [15.3.1](https://www.github.com/yargs/yargs/compare/v15.3.0...v15.3.1) (2020-03-16)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
### Bug Fixes
|
|
71
|
-
|
|
72
|
-
* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential
|
|
73
|
-
prototype pollution vulnerability. This was reported by the Snyk Security Research Team. ([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2))
|
|
74
|
-
|
|
75
|
-
## [15.3.0](https://www.github.com/yargs/yargs/compare/v15.2.0...v15.3.0) (2020-03-08)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
### Features
|
|
79
|
-
|
|
80
|
-
* **yargs-parser:** introduce single-digit boolean aliases ([#1576](https://www.github.com/yargs/yargs/issues/1576)) ([3af7f04](https://www.github.com/yargs/yargs/commit/3af7f04cdbfcbd4b3f432aca5144d43f21958c39))
|
|
81
|
-
* add usage for single-digit boolean aliases ([#1580](https://www.github.com/yargs/yargs/issues/1580)) ([6014e39](https://www.github.com/yargs/yargs/commit/6014e39bca3a1e8445aa0fb2a435f6181e344c45))
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### Bug Fixes
|
|
85
|
-
|
|
86
|
-
* address ambiguity between nargs of 1 and requiresArg ([#1572](https://www.github.com/yargs/yargs/issues/1572)) ([a5edc32](https://www.github.com/yargs/yargs/commit/a5edc328ecb3f90d1ba09cfe70a0040f68adf50a))
|
|
87
|
-
|
|
88
|
-
## [15.2.0](https://www.github.com/yargs/yargs/compare/v15.1.0...v15.2.0) (2020-03-01)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
### ⚠ BREAKING CHANGES
|
|
92
|
-
|
|
93
|
-
* **deps:** yargs-parser@17.0.0 no longer implicitly creates arrays out of boolean
|
|
94
|
-
arguments when duplicates are provided
|
|
95
|
-
|
|
96
|
-
### Features
|
|
97
|
-
|
|
98
|
-
* **completion:** takes negated flags into account when boolean-negation is set ([#1509](https://www.github.com/yargs/yargs/issues/1509)) ([7293ad5](https://www.github.com/yargs/yargs/commit/7293ad50d20ea0fb7dd1ac9b925e90e1bd95dea8))
|
|
99
|
-
* **deps:** pull in yargs-parser@17.0.0 ([#1553](https://www.github.com/yargs/yargs/issues/1553)) ([b9409da](https://www.github.com/yargs/yargs/commit/b9409da199ebca515a848489c206b807fab2e65d))
|
|
100
|
-
* deprecateOption ([#1559](https://www.github.com/yargs/yargs/issues/1559)) ([8aae333](https://www.github.com/yargs/yargs/commit/8aae3332251d09fa136db17ef4a40d83fa052bc4))
|
|
101
|
-
* display appropriate $0 for electron apps ([#1536](https://www.github.com/yargs/yargs/issues/1536)) ([d0e4379](https://www.github.com/yargs/yargs/commit/d0e437912917d6a66bb5128992fa2f566a5f830b))
|
|
102
|
-
* introduces strictCommands() subset of strict mode ([#1540](https://www.github.com/yargs/yargs/issues/1540)) ([1d4cca3](https://www.github.com/yargs/yargs/commit/1d4cca395a98b395e6318f0505fc73bef8b01350))
|
|
103
|
-
* **deps:** yargs-parser with 'greedy-array' configuration ([#1569](https://www.github.com/yargs/yargs/issues/1569)) ([a03a320](https://www.github.com/yargs/yargs/commit/a03a320dbf5c0ce33d829a857fc04a651c0bb53e))
|
|
5
|
+
### [16.1.1](https://www.github.com/yargs/yargs/compare/v16.1.0...v16.1.1) (2020-11-15)
|
|
104
6
|
|
|
105
7
|
|
|
106
8
|
### Bug Fixes
|
|
107
9
|
|
|
108
|
-
*
|
|
109
|
-
* **
|
|
110
|
-
* **locales:** only translate default option group name ([acc16de](https://www.github.com/yargs/yargs/commit/acc16de6b846ea7332db753646a9cec76b589162))
|
|
111
|
-
* **locales:** remove extra space in French for 'default' ([#1564](https://www.github.com/yargs/yargs/issues/1564)) ([ecfc2c4](https://www.github.com/yargs/yargs/commit/ecfc2c474575c6cdbc6d273c94c13181bd1dbaa6))
|
|
112
|
-
* **translations:** add French translation for unknown command ([#1563](https://www.github.com/yargs/yargs/issues/1563)) ([18b0b75](https://www.github.com/yargs/yargs/commit/18b0b752424bf560271e670ff95a0f90c8386787))
|
|
113
|
-
* **translations:** fix pluralization in error messages. ([#1557](https://www.github.com/yargs/yargs/issues/1557)) ([94fa38c](https://www.github.com/yargs/yargs/commit/94fa38cbab8d86943e87bf41d368ed56dffa6835))
|
|
114
|
-
* **yargs:** correct support of bundled electron apps ([#1554](https://www.github.com/yargs/yargs/issues/1554)) ([a0b61ac](https://www.github.com/yargs/yargs/commit/a0b61ac21e2b554aa73dbf1a66d4a7af94047c2f))
|
|
10
|
+
* expose helpers for legacy versions of Node.js ([#1801](https://www.github.com/yargs/yargs/issues/1801)) ([107deaa](https://www.github.com/yargs/yargs/commit/107deaa4f68b7bc3f2386041e1f4fe0272b29c0a))
|
|
11
|
+
* **deno:** get yargs working on deno@1.5.x ([#1799](https://www.github.com/yargs/yargs/issues/1799)) ([cb01c98](https://www.github.com/yargs/yargs/commit/cb01c98c44e30f55c2dc9434caef524ae433d9a4))
|
|
115
12
|
|
|
116
|
-
## [
|
|
13
|
+
## [16.1.0](https://www.github.com/yargs/yargs/compare/v16.0.3...v16.1.0) (2020-10-15)
|
|
117
14
|
|
|
118
15
|
|
|
119
16
|
### Features
|
|
120
17
|
|
|
121
|
-
*
|
|
122
|
-
* complete short options with a single dash ([#1507](https://www.github.com/yargs/yargs/issues/1507)) ([99011ab](https://www.github.com/yargs/yargs/commit/99011ab5ba90232506ece0a17e59e2001a1ab562))
|
|
123
|
-
* onFinishCommand handler ([#1473](https://www.github.com/yargs/yargs/issues/1473)) ([fe380cd](https://www.github.com/yargs/yargs/commit/fe380cd356aa33aef0449facd59c22cab8930ac9))
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
### Bug Fixes
|
|
127
|
-
|
|
128
|
-
* getCompletion() was not working for options ([#1495](https://www.github.com/yargs/yargs/issues/1495)) ([463feb2](https://www.github.com/yargs/yargs/commit/463feb2870158eb9df670222b0f0a40a05cf18d0))
|
|
129
|
-
* misspelling of package.json `engines` field ([0891d0e](https://www.github.com/yargs/yargs/commit/0891d0ed35b30c83a6d9e9f6a5c5f84d13c546a0))
|
|
130
|
-
* populate positionals when unknown-options-as-args is set ([#1508](https://www.github.com/yargs/yargs/issues/1508)) ([bb0f2eb](https://www.github.com/yargs/yargs/commit/bb0f2eb996fa4e19d330b31a01c2036cafa99a7e)), closes [#1444](https://www.github.com/yargs/yargs/issues/1444)
|
|
131
|
-
* show 2 dashes on help for single digit option key or alias ([#1493](https://www.github.com/yargs/yargs/issues/1493)) ([63b3dd3](https://www.github.com/yargs/yargs/commit/63b3dd31a455d428902220c1992ae930e18aff5c))
|
|
132
|
-
* **docs:** use recommended cjs import syntax for ts examples ([#1513](https://www.github.com/yargs/yargs/issues/1513)) ([f9a18bf](https://www.github.com/yargs/yargs/commit/f9a18bfd624a5013108084f690cd8a1de794c430))
|
|
133
|
-
|
|
134
|
-
### [15.0.2](https://www.github.com/yargs/yargs/compare/v15.0.1...v15.0.2) (2019-11-19)
|
|
18
|
+
* expose hideBin helper for CJS ([#1768](https://www.github.com/yargs/yargs/issues/1768)) ([63e1173](https://www.github.com/yargs/yargs/commit/63e1173bb47dc651c151973a16ef659082a9ae66))
|
|
135
19
|
|
|
136
20
|
|
|
137
21
|
### Bug Fixes
|
|
138
22
|
|
|
139
|
-
*
|
|
23
|
+
* **deno:** update types for deno ^1.4.0 ([#1772](https://www.github.com/yargs/yargs/issues/1772)) ([0801752](https://www.github.com/yargs/yargs/commit/080175207d281be63edf90adfe4f0568700b0bf5))
|
|
24
|
+
* **exports:** node 13.0-13.6 require a string fallback ([#1776](https://www.github.com/yargs/yargs/issues/1776)) ([b45c43a](https://www.github.com/yargs/yargs/commit/b45c43a5f64b565c3794f9792150eaeec4e00b69))
|
|
25
|
+
* **modules:** module path was incorrect ([#1759](https://www.github.com/yargs/yargs/issues/1759)) ([95a4a0a](https://www.github.com/yargs/yargs/commit/95a4a0ac573cfe158e6e4bc8c8682ebd1644a198))
|
|
26
|
+
* **positional:** positional strings no longer drop decimals ([#1761](https://www.github.com/yargs/yargs/issues/1761)) ([e1a300f](https://www.github.com/yargs/yargs/commit/e1a300f1293ad821c900284616337f080b207980))
|
|
27
|
+
* make positionals in -- count towards validation ([#1752](https://www.github.com/yargs/yargs/issues/1752)) ([eb2b29d](https://www.github.com/yargs/yargs/commit/eb2b29d34f1a41e0fd6c4e841960e5bfc329dc3c))
|
|
140
28
|
|
|
141
|
-
### [
|
|
29
|
+
### [16.0.3](https://www.github.com/yargs/yargs/compare/v16.0.2...v16.0.3) (2020-09-10)
|
|
142
30
|
|
|
143
31
|
|
|
144
32
|
### Bug Fixes
|
|
145
33
|
|
|
146
|
-
*
|
|
147
|
-
|
|
148
|
-
## [15.0.0](https://www.github.com/yargs/yargs/compare/v14.2.0...v15.0.0) (2019-11-10)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
### ⚠ BREAKING CHANGES
|
|
152
|
-
|
|
153
|
-
* **deps:** yargs-parser now throws on invalid combinations of config (#1470)
|
|
154
|
-
* yargs-parser@16.0.0 drops support for Node 6
|
|
155
|
-
* drop Node 6 support (#1461)
|
|
156
|
-
* remove package.json-based parserConfiguration (#1460)
|
|
157
|
-
|
|
158
|
-
### Features
|
|
159
|
-
|
|
160
|
-
* **deps:** yargs-parser now throws on invalid combinations of config ([#1470](https://www.github.com/yargs/yargs/issues/1470)) ([c10c38c](https://www.github.com/yargs/yargs/commit/c10c38cca04298f96b55a7e374a9a134abefffa7))
|
|
161
|
-
* expose `Parser` from `require('yargs/yargs')` ([#1477](https://www.github.com/yargs/yargs/issues/1477)) ([1840ba2](https://www.github.com/yargs/yargs/commit/1840ba22f1a24c0ece8e32bbd31db4134a080aee))
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
### Bug Fixes
|
|
165
|
-
|
|
166
|
-
* **docs:**
|
|
167
|
-
cript import to prevent a future major release warning ([#1441](https://www.github.com/yargs/yargs/issues/1441)) ([b1b156a](https://www.github.com/yargs/yargs/commit/b1b156a3eb4ddd6803fbbd56c611a77919293000))
|
|
168
|
-
* stop-parse was not being respected by commands ([#1459](https://www.github.com/yargs/yargs/issues/1459)) ([12c82e6](https://www.github.com/yargs/yargs/commit/12c82e62663e928148a7ee2f51629aa26a0f9bb2))
|
|
169
|
-
* update to yargs-parser with fix for array default values ([#1463](https://www.github.com/yargs/yargs/issues/1463)) ([ebee59d](https://www.github.com/yargs/yargs/commit/ebee59d9022da538410e69a5c025019ed46d13d2))
|
|
170
|
-
* **docs:** update boolean description and examples in docs ([#1474](https://www.github.com/yargs/yargs/issues/1474)) ([afd5b48](https://www.github.com/yargs/yargs/commit/afd5b4871bfeb90d58351ac56c5c44a83ef033e6))
|
|
171
|
-
|
|
34
|
+
* move yargs.cjs to yargs to fix Node 10 imports ([#1747](https://www.github.com/yargs/yargs/issues/1747)) ([5bfb85b](https://www.github.com/yargs/yargs/commit/5bfb85b33b85db8a44b5f7a700a8e4dbaf022df0))
|
|
172
35
|
|
|
173
|
-
###
|
|
174
|
-
|
|
175
|
-
* drop Node 6 support ([#1461](https://www.github.com/yargs/yargs/issues/1461)) ([2ba8ce0](https://www.github.com/yargs/yargs/commit/2ba8ce05e8fefbeffc6cb7488d9ebf6e86cceb1d))
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
### Code Refactoring
|
|
179
|
-
|
|
180
|
-
* remove package.json-based parserConfiguration ([#1460](https://www.github.com/yargs/yargs/issues/1460)) ([0d3642b](https://www.github.com/yargs/yargs/commit/0d3642b6f829b637938774c0c6ce5f6bfe1afa51))
|
|
181
|
-
|
|
182
|
-
## [14.2.0](https://github.com/yargs/yargs/compare/v14.1.0...v14.2.0) (2019-10-07)
|
|
36
|
+
### [16.0.2](https://www.github.com/yargs/yargs/compare/v16.0.1...v16.0.2) (2020-09-09)
|
|
183
37
|
|
|
184
38
|
|
|
185
39
|
### Bug Fixes
|
|
186
40
|
|
|
187
|
-
*
|
|
188
|
-
* 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))
|
|
189
|
-
* groups were not being maintained for nested commands ([#1430](https://github.com/yargs/yargs/issues/1430)) ([d38650e](https://github.com/yargs/yargs/commit/d38650e))
|
|
190
|
-
* **docs:** broken markdown link ([#1426](https://github.com/yargs/yargs/issues/1426)) ([236e24e](https://github.com/yargs/yargs/commit/236e24e))
|
|
191
|
-
* support merging deeply nested configuration ([#1423](https://github.com/yargs/yargs/issues/1423)) ([bae66fe](https://github.com/yargs/yargs/commit/bae66fe))
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
### Features
|
|
195
|
-
|
|
196
|
-
* **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))
|
|
41
|
+
* **typescript:** yargs-parser was breaking @types/yargs ([#1745](https://www.github.com/yargs/yargs/issues/1745)) ([2253284](https://www.github.com/yargs/yargs/commit/2253284b233cceabd8db677b81c5bf1755eef230))
|
|
197
42
|
|
|
198
|
-
|
|
43
|
+
### [16.0.1](https://www.github.com/yargs/yargs/compare/v16.0.0...v16.0.1) (2020-09-09)
|
|
199
44
|
|
|
200
45
|
|
|
201
46
|
### Bug Fixes
|
|
202
47
|
|
|
203
|
-
*
|
|
204
|
-
* 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))
|
|
205
|
-
* 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))
|
|
206
|
-
* showCompletionScript was logging script twice ([#1388](https://github.com/yargs/yargs/issues/1388)) ([07c8537](https://github.com/yargs/yargs/commit/07c8537))
|
|
207
|
-
* strict() should not ignore hyphenated arguments ([#1414](https://github.com/yargs/yargs/issues/1414)) ([b774b5e](https://github.com/yargs/yargs/commit/b774b5e))
|
|
208
|
-
* **docs:** formalize existing callback argument to showHelp ([#1386](https://github.com/yargs/yargs/issues/1386)) ([d217764](https://github.com/yargs/yargs/commit/d217764))
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
### Features
|
|
212
|
-
|
|
213
|
-
* 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))
|
|
48
|
+
* code was not passed to process.exit ([#1742](https://www.github.com/yargs/yargs/issues/1742)) ([d1a9930](https://www.github.com/yargs/yargs/commit/d1a993035a2f76c138460052cf19425f9684b637))
|
|
214
49
|
|
|
215
|
-
## [
|
|
50
|
+
## [16.0.0](https://www.github.com/yargs/yargs/compare/v15.4.2...v16.0.0) (2020-09-09)
|
|
216
51
|
|
|
217
52
|
|
|
218
53
|
### ⚠ BREAKING CHANGES
|
|
219
54
|
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
* 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))
|
|
227
|
-
* prefer user supplied script name in usage ([#1383](https://github.com/yargs/yargs/issues/1383)) ([28c74b9](https://github.com/yargs/yargs/commit/28c74b9))
|
|
228
|
-
* **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))
|
|
229
|
-
* **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))
|
|
230
|
-
* do not allow additional positionals in strict mode ([35d777c](https://github.com/yargs/yargs/commit/35d777c))
|
|
231
|
-
* 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))
|
|
232
|
-
* 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)
|
|
233
|
-
* 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)
|
|
234
|
-
|
|
235
|
-
### Features
|
|
236
|
-
|
|
237
|
-
* adds support for multiple epilog messages ([#1384](https://github.com/yargs/yargs/issues/1384)) ([07a5554](https://github.com/yargs/yargs/commit/07a5554))
|
|
238
|
-
* allow completionCommand to be set via showCompletionScript ([#1385](https://github.com/yargs/yargs/issues/1385)) ([5562853](https://github.com/yargs/yargs/commit/5562853))
|
|
239
|
-
|
|
240
|
-
## [13.3.0](https://www.github.com/yargs/yargs/compare/v13.2.4...v13.3.0) (2019-06-10)
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
### Bug Fixes
|
|
244
|
-
|
|
245
|
-
* **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))
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
### Features
|
|
249
|
-
|
|
250
|
-
* **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))
|
|
251
|
-
* support defaultDescription for positional arguments ([812048c](https://www.github.com/yargs/yargs/commit/812048c))
|
|
252
|
-
|
|
253
|
-
### [13.2.4](https://github.com/yargs/yargs/compare/v13.2.3...v13.2.4) (2019-05-13)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
### Bug Fixes
|
|
257
|
-
|
|
258
|
-
* **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))
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
### [13.2.3](https://github.com/yargs/yargs/compare/v13.2.2...v13.2.3) (2019-05-05)
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
### Bug Fixes
|
|
266
|
-
|
|
267
|
-
* **deps:** upgrade cliui for compatibility with latest chalk. ([#1330](https://github.com/yargs/yargs/issues/1330)) ([b20db65](https://github.com/yargs/yargs/commit/b20db65))
|
|
268
|
-
* address issues with dutch translation ([#1316](https://github.com/yargs/yargs/issues/1316)) ([0295132](https://github.com/yargs/yargs/commit/0295132))
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
### Tests
|
|
272
|
-
|
|
273
|
-
* accept differently formatted output ([#1327](https://github.com/yargs/yargs/issues/1327)) ([c294d1b](https://github.com/yargs/yargs/commit/c294d1b))
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
## [13.2.2](https://github.com/yargs/yargs/compare/v13.2.1...v13.2.2) (2019-03-06)
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
## [13.2.1](https://github.com/yargs/yargs/compare/v13.2.0...v13.2.1) (2019-02-18)
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
### Bug Fixes
|
|
285
|
-
|
|
286
|
-
* add zsh script to files array ([3180224](https://github.com/yargs/yargs/commit/3180224))
|
|
287
|
-
* support options/sub-commands in zsh completion ([0a96394](https://github.com/yargs/yargs/commit/0a96394))
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
# [13.2.0](https://github.com/yargs/yargs/compare/v13.1.0...v13.2.0) (2019-02-15)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
### Features
|
|
294
|
-
|
|
295
|
-
* 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)
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
<a name="13.1.0"></a>
|
|
299
|
-
# [13.1.0](https://github.com/yargs/yargs/compare/v13.0.0...v13.1.0) (2019-02-12)
|
|
300
|
-
|
|
55
|
+
* tweaks to ESM/Deno API surface: now exports yargs function by default; getProcessArgvWithoutBin becomes hideBin; types now exported for Deno.
|
|
56
|
+
* find-up replaced with escalade; export map added (limits importable files in Node >= 12); yarser-parser@19.x.x (new decamelize/camelcase implementation).
|
|
57
|
+
* **usage:** single character aliases are now shown first in help output
|
|
58
|
+
* rebase helper is no longer provided on yargs instance.
|
|
59
|
+
* drop support for EOL Node 8 (#1686)
|
|
301
60
|
|
|
302
61
|
### Features
|
|
303
62
|
|
|
304
|
-
*
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
63
|
+
* adds strictOptions() ([#1738](https://www.github.com/yargs/yargs/issues/1738)) ([b215fba](https://www.github.com/yargs/yargs/commit/b215fba0ed6e124e5aad6cf22c8d5875661c63a3))
|
|
64
|
+
* **helpers:** rebase, Parser, applyExtends now blessed helpers ([#1733](https://www.github.com/yargs/yargs/issues/1733)) ([c7debe8](https://www.github.com/yargs/yargs/commit/c7debe8eb1e5bc6ea20b5ed68026c56e5ebec9e1))
|
|
65
|
+
* adds support for ESM and Deno ([#1708](https://www.github.com/yargs/yargs/issues/1708)) ([ac6d5d1](https://www.github.com/yargs/yargs/commit/ac6d5d105a75711fe703f6a39dad5181b383d6c6))
|
|
66
|
+
* drop support for EOL Node 8 ([#1686](https://www.github.com/yargs/yargs/issues/1686)) ([863937f](https://www.github.com/yargs/yargs/commit/863937f23c3102f804cdea78ee3097e28c7c289f))
|
|
67
|
+
* i18n for ESM and Deno ([#1735](https://www.github.com/yargs/yargs/issues/1735)) ([c71783a](https://www.github.com/yargs/yargs/commit/c71783a5a898a0c0e92ac501c939a3ec411ac0c1))
|
|
68
|
+
* tweaks to API surface based on user feedback ([#1726](https://www.github.com/yargs/yargs/issues/1726)) ([4151fee](https://www.github.com/yargs/yargs/commit/4151fee4c33a97d26bc40de7e623e5b0eb87e9bb))
|
|
69
|
+
* **usage:** single char aliases first in help ([#1574](https://www.github.com/yargs/yargs/issues/1574)) ([a552990](https://www.github.com/yargs/yargs/commit/a552990c120646c2d85a5c9b628e1ce92a68e797))
|
|
310
70
|
|
|
311
71
|
|
|
312
72
|
### Bug Fixes
|
|
313
73
|
|
|
314
|
-
* **
|
|
315
|
-
* **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))
|
|
316
|
-
* better bash path completion ([#1272](https://github.com/yargs/yargs/issues/1272)) ([da75ea2](https://github.com/yargs/yargs/commit/da75ea2))
|
|
317
|
-
* middleware added multiple times due to reference bug ([#1282](https://github.com/yargs/yargs/issues/1282)) ([64af518](https://github.com/yargs/yargs/commit/64af518))
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
### Chores
|
|
321
|
-
|
|
322
|
-
* ~drop Node 6 from testing matrix ([#1287](https://github.com/yargs/yargs/issues/1287)) ([ef16792](https://github.com/yargs/yargs/commit/ef16792))~
|
|
323
|
-
* _opting to not drop Node 6 support until April, [see](https://github.com/nodejs/Release)._
|
|
324
|
-
* update dependencies ([#1284](https://github.com/yargs/yargs/issues/1284)) ([f25de4f](https://github.com/yargs/yargs/commit/f25de4f))
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
### Features
|
|
328
|
-
|
|
329
|
-
* Add `.parserConfiguration()` method, deprecating package.json config ([#1262](https://github.com/yargs/yargs/issues/1262)) ([3c6869a](https://github.com/yargs/yargs/commit/3c6869a))
|
|
330
|
-
* adds config option for sorting command output ([#1256](https://github.com/yargs/yargs/issues/1256)) ([6916ce9](https://github.com/yargs/yargs/commit/6916ce9))
|
|
331
|
-
* 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))
|
|
332
|
-
* support promises in middleware ([f3a4e4f](https://github.com/yargs/yargs/commit/f3a4e4f))
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
### BREAKING CHANGES
|
|
74
|
+
* **yargs:** add missing command(module) signature ([#1707](https://www.github.com/yargs/yargs/issues/1707)) ([0f81024](https://www.github.com/yargs/yargs/commit/0f810245494ccf13a35b7786d021b30fc95ecad5)), closes [#1704](https://www.github.com/yargs/yargs/issues/1704)
|
|
336
75
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
* see [yargs-parser@12.0.0 CHANGELOG](https://github.com/yargs/yargs-parser/blob/master/CHANGELOG.md#breaking-changes)
|
|
340
|
-
* we now warn if the yargs stanza package.json is used.
|
|
76
|
+
[Older CHANGELOG Entries](https://github.com/yargs/yargs/blob/master/docs/CHANGELOG-historical.md)
|
|
77
|
+
|
package/README.md
CHANGED
|
@@ -21,9 +21,22 @@ Yargs helps you build interactive command line tools, by parsing arguments and g
|
|
|
21
21
|
It gives you:
|
|
22
22
|
|
|
23
23
|
* commands and (grouped) options (`my-program.js serve --port=5000`).
|
|
24
|
-
* a dynamically generated help menu based on your arguments
|
|
24
|
+
* a dynamically generated help menu based on your arguments:
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
```
|
|
27
|
+
mocha [spec..]
|
|
28
|
+
|
|
29
|
+
Run tests with Mocha
|
|
30
|
+
|
|
31
|
+
Commands
|
|
32
|
+
mocha inspect [spec..] Run tests with Mocha [default]
|
|
33
|
+
mocha init <path> create a client-side Mocha setup at <path>
|
|
34
|
+
|
|
35
|
+
Rules & Behavior
|
|
36
|
+
--allow-uncaught Allow uncaught errors to propagate [boolean]
|
|
37
|
+
--async-only, -A Require all tests to use a callback (async) or
|
|
38
|
+
return a Promise [boolean]
|
|
39
|
+
```
|
|
27
40
|
|
|
28
41
|
* bash-completion shortcuts for commands and options.
|
|
29
42
|
* and [tons more](/docs/api.md).
|
|
@@ -46,7 +59,9 @@ npm i yargs@next
|
|
|
46
59
|
|
|
47
60
|
```javascript
|
|
48
61
|
#!/usr/bin/env node
|
|
49
|
-
const
|
|
62
|
+
const yargs = require('yargs/yargs')
|
|
63
|
+
const { hideBin } = require('yargs/helpers')
|
|
64
|
+
const argv = yargs(hideBin(process.argv)).argv
|
|
50
65
|
|
|
51
66
|
if (argv.ships > 3 && argv.distance < 53.5) {
|
|
52
67
|
console.log('Plunder more riffiwobbles!')
|
|
@@ -67,7 +82,10 @@ Retreat from the xupptumblers!
|
|
|
67
82
|
|
|
68
83
|
```javascript
|
|
69
84
|
#!/usr/bin/env node
|
|
70
|
-
require('yargs')
|
|
85
|
+
const yargs = require('yargs/yargs')
|
|
86
|
+
const { hideBin } = require('yargs/helpers')
|
|
87
|
+
|
|
88
|
+
yargs(hideBin(process.argv))
|
|
71
89
|
.command('serve [port]', 'start the server', (yargs) => {
|
|
72
90
|
yargs
|
|
73
91
|
.positional('port', {
|
|
@@ -106,10 +124,10 @@ As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):
|
|
|
106
124
|
|
|
107
125
|
```typescript
|
|
108
126
|
import yargs from 'https://deno.land/x/yargs/deno.ts'
|
|
109
|
-
import { Arguments
|
|
127
|
+
import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'
|
|
110
128
|
|
|
111
|
-
yargs()
|
|
112
|
-
.command('download <files...>', 'download a list of files', (yargs:
|
|
129
|
+
yargs(Deno.args)
|
|
130
|
+
.command('download <files...>', 'download a list of files', (yargs: any) => {
|
|
113
131
|
return yargs.positional('files', {
|
|
114
132
|
describe: 'a list of files to do something with'
|
|
115
133
|
})
|
|
@@ -118,7 +136,7 @@ yargs()
|
|
|
118
136
|
})
|
|
119
137
|
.strictCommands()
|
|
120
138
|
.demandCommand(1)
|
|
121
|
-
.
|
|
139
|
+
.argv
|
|
122
140
|
```
|
|
123
141
|
|
|
124
142
|
### ESM
|
|
@@ -162,6 +180,7 @@ Having problems? want to contribute? join our [community slack](http://devtoolsc
|
|
|
162
180
|
* [Composing Your App Using Commands](/docs/advanced.md#commands)
|
|
163
181
|
* [Building Configurable CLI Apps](/docs/advanced.md#configuration)
|
|
164
182
|
* [Customizing Yargs' Parser](/docs/advanced.md#customizing)
|
|
183
|
+
* [Bundling yargs](/docs/bundling.md)
|
|
165
184
|
* [Contributing](/contributing.md)
|
|
166
185
|
|
|
167
186
|
## Supported Node.js Versions
|
package/browser.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Bootstrap yargs for browser:
|
|
2
|
-
import browserPlatformShim from './lib/platform-shims/browser.mjs'
|
|
3
|
-
import {
|
|
2
|
+
import browserPlatformShim from './lib/platform-shims/browser.mjs';
|
|
3
|
+
import {YargsWithShim} from './build/lib/yargs-factory.js';
|
|
4
4
|
|
|
5
|
-
const Yargs = YargsWithShim(browserPlatformShim)
|
|
5
|
+
const Yargs = YargsWithShim(browserPlatformShim);
|
|
6
6
|
|
|
7
|
-
export default Yargs
|
|
7
|
+
export default Yargs;
|