yargs 16.0.3 → 16.2.0
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 +34 -293
- package/README.md +27 -8
- package/browser.mjs +4 -4
- package/build/index.cjs +432 -276
- package/build/lib/argsert.js +9 -5
- package/build/lib/command.js +98 -74
- 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 -26
- package/yargs +3 -2
- package/helpers.mjs +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -2,346 +2,87 @@
|
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
* 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))
|
|
11
|
-
|
|
12
|
-
### [16.0.2](https://www.github.com/yargs/yargs/compare/v16.0.1...v16.0.2) (2020-09-09)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Bug Fixes
|
|
16
|
-
|
|
17
|
-
* **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))
|
|
18
|
-
|
|
19
|
-
### [16.0.1](https://www.github.com/yargs/yargs/compare/v16.0.0...v16.0.1) (2020-09-09)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
* 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))
|
|
25
|
-
|
|
26
|
-
## [16.0.0](https://www.github.com/yargs/yargs/compare/v15.4.2...v16.0.0) (2020-09-09)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### ⚠ BREAKING CHANGES
|
|
30
|
-
|
|
31
|
-
* tweaks to ESM/Deno API surface: now exports yargs function by default; getProcessArgvWithoutBin becomes hideBin; types now exported for Deno.
|
|
32
|
-
* find-up replaced with escalade; export map added (limits importable files in Node >= 12); yarser-parser@19.x.x (new decamelize/camelcase implementation).
|
|
33
|
-
* **usage:** single character aliases are now shown first in help output
|
|
34
|
-
* rebase helper is no longer provided on yargs instance.
|
|
35
|
-
* drop support for EOL Node 8 (#1686)
|
|
36
|
-
|
|
37
|
-
### Features
|
|
38
|
-
|
|
39
|
-
* adds strictOptions() ([#1738](https://www.github.com/yargs/yargs/issues/1738)) ([b215fba](https://www.github.com/yargs/yargs/commit/b215fba0ed6e124e5aad6cf22c8d5875661c63a3))
|
|
40
|
-
* **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))
|
|
41
|
-
* adds support for ESM and Deno ([#1708](https://www.github.com/yargs/yargs/issues/1708)) ([ac6d5d1](https://www.github.com/yargs/yargs/commit/ac6d5d105a75711fe703f6a39dad5181b383d6c6))
|
|
42
|
-
* drop support for EOL Node 8 ([#1686](https://www.github.com/yargs/yargs/issues/1686)) ([863937f](https://www.github.com/yargs/yargs/commit/863937f23c3102f804cdea78ee3097e28c7c289f))
|
|
43
|
-
* i18n for ESM and Deno ([#1735](https://www.github.com/yargs/yargs/issues/1735)) ([c71783a](https://www.github.com/yargs/yargs/commit/c71783a5a898a0c0e92ac501c939a3ec411ac0c1))
|
|
44
|
-
* 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))
|
|
45
|
-
* **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))
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
### Bug Fixes
|
|
49
|
-
|
|
50
|
-
* **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)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## [15.4.0](https://www.github.com/yargs/yargs/compare/v15.3.1...v15.4.0) (2020-06-30)
|
|
5
|
+
## [16.2.0](https://www.github.com/yargs/yargs/compare/v16.1.1...v16.2.0) (2020-12-05)
|
|
54
6
|
|
|
55
7
|
|
|
56
8
|
### Features
|
|
57
9
|
|
|
58
|
-
*
|
|
59
|
-
* support array of examples ([#1682](https://www.github.com/yargs/yargs/issues/1682)) ([225ab82](https://www.github.com/yargs/yargs/commit/225ab8271938bed3a48d23175f3d580ce8cd1306))
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### Bug Fixes
|
|
63
|
-
|
|
64
|
-
* **docs:** describe usage of `.check()` in more detail ([932cd11](https://www.github.com/yargs/yargs/commit/932cd1177e93f5cc99edfe57a4028e30717bf8fb))
|
|
65
|
-
* **i18n:** Japanese translation phrasing ([#1619](https://www.github.com/yargs/yargs/issues/1619)) ([0894175](https://www.github.com/yargs/yargs/commit/089417550ef5a5b8ce3578dd2a989191300b64cd))
|
|
66
|
-
* **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))
|
|
67
|
-
* **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))
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
### Reverts
|
|
71
|
-
|
|
72
|
-
* 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)
|
|
73
|
-
|
|
74
|
-
### [15.3.1](https://www.github.com/yargs/yargs/compare/v15.3.0...v15.3.1) (2020-03-16)
|
|
10
|
+
* command() now accepts an array of modules ([f415388](https://www.github.com/yargs/yargs/commit/f415388cc454d02786c65c50dd6c7a0cf9d8b842))
|
|
75
11
|
|
|
76
12
|
|
|
77
13
|
### Bug Fixes
|
|
78
14
|
|
|
79
|
-
*
|
|
80
|
-
prototype pollution vulnerability. This was reported by the Snyk Security Research Team. ([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2))
|
|
81
|
-
|
|
82
|
-
## [15.3.0](https://www.github.com/yargs/yargs/compare/v15.2.0...v15.3.0) (2020-03-08)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
### Features
|
|
86
|
-
|
|
87
|
-
* **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))
|
|
88
|
-
* 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))
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
### Bug Fixes
|
|
92
|
-
|
|
93
|
-
* 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))
|
|
94
|
-
|
|
95
|
-
## [15.2.0](https://www.github.com/yargs/yargs/compare/v15.1.0...v15.2.0) (2020-03-01)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
### ⚠ BREAKING CHANGES
|
|
99
|
-
|
|
100
|
-
* **deps:** yargs-parser@17.0.0 no longer implicitly creates arrays out of boolean
|
|
101
|
-
arguments when duplicates are provided
|
|
102
|
-
|
|
103
|
-
### Features
|
|
15
|
+
* add package.json to module exports ([#1818](https://www.github.com/yargs/yargs/issues/1818)) ([d783a49](https://www.github.com/yargs/yargs/commit/d783a49a7f21c9bbd4eec2990268f3244c4d5662)), closes [#1817](https://www.github.com/yargs/yargs/issues/1817)
|
|
104
16
|
|
|
105
|
-
|
|
106
|
-
* **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))
|
|
107
|
-
* deprecateOption ([#1559](https://www.github.com/yargs/yargs/issues/1559)) ([8aae333](https://www.github.com/yargs/yargs/commit/8aae3332251d09fa136db17ef4a40d83fa052bc4))
|
|
108
|
-
* display appropriate $0 for electron apps ([#1536](https://www.github.com/yargs/yargs/issues/1536)) ([d0e4379](https://www.github.com/yargs/yargs/commit/d0e437912917d6a66bb5128992fa2f566a5f830b))
|
|
109
|
-
* introduces strictCommands() subset of strict mode ([#1540](https://www.github.com/yargs/yargs/issues/1540)) ([1d4cca3](https://www.github.com/yargs/yargs/commit/1d4cca395a98b395e6318f0505fc73bef8b01350))
|
|
110
|
-
* **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))
|
|
17
|
+
### [16.1.1](https://www.github.com/yargs/yargs/compare/v16.1.0...v16.1.1) (2020-11-15)
|
|
111
18
|
|
|
112
19
|
|
|
113
20
|
### Bug Fixes
|
|
114
21
|
|
|
115
|
-
*
|
|
116
|
-
* **
|
|
117
|
-
* **locales:** only translate default option group name ([acc16de](https://www.github.com/yargs/yargs/commit/acc16de6b846ea7332db753646a9cec76b589162))
|
|
118
|
-
* **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))
|
|
119
|
-
* **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))
|
|
120
|
-
* **translations:** fix pluralization in error messages. ([#1557](https://www.github.com/yargs/yargs/issues/1557)) ([94fa38c](https://www.github.com/yargs/yargs/commit/94fa38cbab8d86943e87bf41d368ed56dffa6835))
|
|
121
|
-
* **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))
|
|
22
|
+
* 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))
|
|
23
|
+
* **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))
|
|
122
24
|
|
|
123
|
-
## [
|
|
25
|
+
## [16.1.0](https://www.github.com/yargs/yargs/compare/v16.0.3...v16.1.0) (2020-10-15)
|
|
124
26
|
|
|
125
27
|
|
|
126
28
|
### Features
|
|
127
29
|
|
|
128
|
-
*
|
|
129
|
-
* 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))
|
|
130
|
-
* onFinishCommand handler ([#1473](https://www.github.com/yargs/yargs/issues/1473)) ([fe380cd](https://www.github.com/yargs/yargs/commit/fe380cd356aa33aef0449facd59c22cab8930ac9))
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
### Bug Fixes
|
|
134
|
-
|
|
135
|
-
* getCompletion() was not working for options ([#1495](https://www.github.com/yargs/yargs/issues/1495)) ([463feb2](https://www.github.com/yargs/yargs/commit/463feb2870158eb9df670222b0f0a40a05cf18d0))
|
|
136
|
-
* misspelling of package.json `engines` field ([0891d0e](https://www.github.com/yargs/yargs/commit/0891d0ed35b30c83a6d9e9f6a5c5f84d13c546a0))
|
|
137
|
-
* 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)
|
|
138
|
-
* 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))
|
|
139
|
-
* **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))
|
|
140
|
-
|
|
141
|
-
### [15.0.2](https://www.github.com/yargs/yargs/compare/v15.0.1...v15.0.2) (2019-11-19)
|
|
30
|
+
* expose hideBin helper for CJS ([#1768](https://www.github.com/yargs/yargs/issues/1768)) ([63e1173](https://www.github.com/yargs/yargs/commit/63e1173bb47dc651c151973a16ef659082a9ae66))
|
|
142
31
|
|
|
143
32
|
|
|
144
33
|
### Bug Fixes
|
|
145
34
|
|
|
146
|
-
*
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
### Bug Fixes
|
|
35
|
+
* **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))
|
|
36
|
+
* **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))
|
|
37
|
+
* **modules:** module path was incorrect ([#1759](https://www.github.com/yargs/yargs/issues/1759)) ([95a4a0a](https://www.github.com/yargs/yargs/commit/95a4a0ac573cfe158e6e4bc8c8682ebd1644a198))
|
|
38
|
+
* **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))
|
|
39
|
+
* make positionals in -- count towards validation ([#1752](https://www.github.com/yargs/yargs/issues/1752)) ([eb2b29d](https://www.github.com/yargs/yargs/commit/eb2b29d34f1a41e0fd6c4e841960e5bfc329dc3c))
|
|
152
40
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
## [15.0.0](https://www.github.com/yargs/yargs/compare/v14.2.0...v15.0.0) (2019-11-10)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
### ⚠ BREAKING CHANGES
|
|
159
|
-
|
|
160
|
-
* **deps:** yargs-parser now throws on invalid combinations of config (#1470)
|
|
161
|
-
* yargs-parser@16.0.0 drops support for Node 6
|
|
162
|
-
* drop Node 6 support (#1461)
|
|
163
|
-
* remove package.json-based parserConfiguration (#1460)
|
|
164
|
-
|
|
165
|
-
### Features
|
|
166
|
-
|
|
167
|
-
* **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))
|
|
168
|
-
* expose `Parser` from `require('yargs/yargs')` ([#1477](https://www.github.com/yargs/yargs/issues/1477)) ([1840ba2](https://www.github.com/yargs/yargs/commit/1840ba22f1a24c0ece8e32bbd31db4134a080aee))
|
|
41
|
+
### [16.0.3](https://www.github.com/yargs/yargs/compare/v16.0.2...v16.0.3) (2020-09-10)
|
|
169
42
|
|
|
170
43
|
|
|
171
44
|
### Bug Fixes
|
|
172
45
|
|
|
173
|
-
*
|
|
174
|
-
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))
|
|
175
|
-
* 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))
|
|
176
|
-
* 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))
|
|
177
|
-
* **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))
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
### Miscellaneous Chores
|
|
181
|
-
|
|
182
|
-
* drop Node 6 support ([#1461](https://www.github.com/yargs/yargs/issues/1461)) ([2ba8ce0](https://www.github.com/yargs/yargs/commit/2ba8ce05e8fefbeffc6cb7488d9ebf6e86cceb1d))
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
### Code Refactoring
|
|
186
|
-
|
|
187
|
-
* remove package.json-based parserConfiguration ([#1460](https://www.github.com/yargs/yargs/issues/1460)) ([0d3642b](https://www.github.com/yargs/yargs/commit/0d3642b6f829b637938774c0c6ce5f6bfe1afa51))
|
|
46
|
+
* 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))
|
|
188
47
|
|
|
189
|
-
|
|
48
|
+
### [16.0.2](https://www.github.com/yargs/yargs/compare/v16.0.1...v16.0.2) (2020-09-09)
|
|
190
49
|
|
|
191
50
|
|
|
192
51
|
### Bug Fixes
|
|
193
52
|
|
|
194
|
-
*
|
|
195
|
-
* 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))
|
|
196
|
-
* groups were not being maintained for nested commands ([#1430](https://github.com/yargs/yargs/issues/1430)) ([d38650e](https://github.com/yargs/yargs/commit/d38650e))
|
|
197
|
-
* **docs:** broken markdown link ([#1426](https://github.com/yargs/yargs/issues/1426)) ([236e24e](https://github.com/yargs/yargs/commit/236e24e))
|
|
198
|
-
* support merging deeply nested configuration ([#1423](https://github.com/yargs/yargs/issues/1423)) ([bae66fe](https://github.com/yargs/yargs/commit/bae66fe))
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
### Features
|
|
202
|
-
|
|
203
|
-
* **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))
|
|
53
|
+
* **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))
|
|
204
54
|
|
|
205
|
-
|
|
55
|
+
### [16.0.1](https://www.github.com/yargs/yargs/compare/v16.0.0...v16.0.1) (2020-09-09)
|
|
206
56
|
|
|
207
57
|
|
|
208
58
|
### Bug Fixes
|
|
209
59
|
|
|
210
|
-
*
|
|
211
|
-
* 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))
|
|
212
|
-
* 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))
|
|
213
|
-
* showCompletionScript was logging script twice ([#1388](https://github.com/yargs/yargs/issues/1388)) ([07c8537](https://github.com/yargs/yargs/commit/07c8537))
|
|
214
|
-
* strict() should not ignore hyphenated arguments ([#1414](https://github.com/yargs/yargs/issues/1414)) ([b774b5e](https://github.com/yargs/yargs/commit/b774b5e))
|
|
215
|
-
* **docs:** formalize existing callback argument to showHelp ([#1386](https://github.com/yargs/yargs/issues/1386)) ([d217764](https://github.com/yargs/yargs/commit/d217764))
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
### Features
|
|
219
|
-
|
|
220
|
-
* 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))
|
|
60
|
+
* 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))
|
|
221
61
|
|
|
222
|
-
## [
|
|
62
|
+
## [16.0.0](https://www.github.com/yargs/yargs/compare/v15.4.2...v16.0.0) (2020-09-09)
|
|
223
63
|
|
|
224
64
|
|
|
225
65
|
### ⚠ BREAKING CHANGES
|
|
226
66
|
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
* 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))
|
|
234
|
-
* prefer user supplied script name in usage ([#1383](https://github.com/yargs/yargs/issues/1383)) ([28c74b9](https://github.com/yargs/yargs/commit/28c74b9))
|
|
235
|
-
* **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))
|
|
236
|
-
* **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))
|
|
237
|
-
* do not allow additional positionals in strict mode ([35d777c](https://github.com/yargs/yargs/commit/35d777c))
|
|
238
|
-
* 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))
|
|
239
|
-
* 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)
|
|
240
|
-
* 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)
|
|
241
|
-
|
|
242
|
-
### Features
|
|
243
|
-
|
|
244
|
-
* adds support for multiple epilog messages ([#1384](https://github.com/yargs/yargs/issues/1384)) ([07a5554](https://github.com/yargs/yargs/commit/07a5554))
|
|
245
|
-
* allow completionCommand to be set via showCompletionScript ([#1385](https://github.com/yargs/yargs/issues/1385)) ([5562853](https://github.com/yargs/yargs/commit/5562853))
|
|
246
|
-
|
|
247
|
-
## [13.3.0](https://www.github.com/yargs/yargs/compare/v13.2.4...v13.3.0) (2019-06-10)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
### Bug Fixes
|
|
251
|
-
|
|
252
|
-
* **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))
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
### Features
|
|
256
|
-
|
|
257
|
-
* **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))
|
|
258
|
-
* support defaultDescription for positional arguments ([812048c](https://www.github.com/yargs/yargs/commit/812048c))
|
|
259
|
-
|
|
260
|
-
### [13.2.4](https://github.com/yargs/yargs/compare/v13.2.3...v13.2.4) (2019-05-13)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
### Bug Fixes
|
|
264
|
-
|
|
265
|
-
* **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))
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
### [13.2.3](https://github.com/yargs/yargs/compare/v13.2.2...v13.2.3) (2019-05-05)
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
### Bug Fixes
|
|
273
|
-
|
|
274
|
-
* **deps:** upgrade cliui for compatibility with latest chalk. ([#1330](https://github.com/yargs/yargs/issues/1330)) ([b20db65](https://github.com/yargs/yargs/commit/b20db65))
|
|
275
|
-
* address issues with dutch translation ([#1316](https://github.com/yargs/yargs/issues/1316)) ([0295132](https://github.com/yargs/yargs/commit/0295132))
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
### Tests
|
|
279
|
-
|
|
280
|
-
* accept differently formatted output ([#1327](https://github.com/yargs/yargs/issues/1327)) ([c294d1b](https://github.com/yargs/yargs/commit/c294d1b))
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
## [13.2.2](https://github.com/yargs/yargs/compare/v13.2.1...v13.2.2) (2019-03-06)
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
## [13.2.1](https://github.com/yargs/yargs/compare/v13.2.0...v13.2.1) (2019-02-18)
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
### Bug Fixes
|
|
292
|
-
|
|
293
|
-
* add zsh script to files array ([3180224](https://github.com/yargs/yargs/commit/3180224))
|
|
294
|
-
* support options/sub-commands in zsh completion ([0a96394](https://github.com/yargs/yargs/commit/0a96394))
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
# [13.2.0](https://github.com/yargs/yargs/compare/v13.1.0...v13.2.0) (2019-02-15)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
### Features
|
|
301
|
-
|
|
302
|
-
* 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)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
<a name="13.1.0"></a>
|
|
306
|
-
# [13.1.0](https://github.com/yargs/yargs/compare/v13.0.0...v13.1.0) (2019-02-12)
|
|
307
|
-
|
|
67
|
+
* tweaks to ESM/Deno API surface: now exports yargs function by default; getProcessArgvWithoutBin becomes hideBin; types now exported for Deno.
|
|
68
|
+
* find-up replaced with escalade; export map added (limits importable files in Node >= 12); yarser-parser@19.x.x (new decamelize/camelcase implementation).
|
|
69
|
+
* **usage:** single character aliases are now shown first in help output
|
|
70
|
+
* rebase helper is no longer provided on yargs instance.
|
|
71
|
+
* drop support for EOL Node 8 (#1686)
|
|
308
72
|
|
|
309
73
|
### Features
|
|
310
74
|
|
|
311
|
-
*
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
75
|
+
* adds strictOptions() ([#1738](https://www.github.com/yargs/yargs/issues/1738)) ([b215fba](https://www.github.com/yargs/yargs/commit/b215fba0ed6e124e5aad6cf22c8d5875661c63a3))
|
|
76
|
+
* **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))
|
|
77
|
+
* adds support for ESM and Deno ([#1708](https://www.github.com/yargs/yargs/issues/1708)) ([ac6d5d1](https://www.github.com/yargs/yargs/commit/ac6d5d105a75711fe703f6a39dad5181b383d6c6))
|
|
78
|
+
* drop support for EOL Node 8 ([#1686](https://www.github.com/yargs/yargs/issues/1686)) ([863937f](https://www.github.com/yargs/yargs/commit/863937f23c3102f804cdea78ee3097e28c7c289f))
|
|
79
|
+
* i18n for ESM and Deno ([#1735](https://www.github.com/yargs/yargs/issues/1735)) ([c71783a](https://www.github.com/yargs/yargs/commit/c71783a5a898a0c0e92ac501c939a3ec411ac0c1))
|
|
80
|
+
* 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))
|
|
81
|
+
* **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))
|
|
317
82
|
|
|
318
83
|
|
|
319
84
|
### Bug Fixes
|
|
320
85
|
|
|
321
|
-
* **
|
|
322
|
-
* **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))
|
|
323
|
-
* better bash path completion ([#1272](https://github.com/yargs/yargs/issues/1272)) ([da75ea2](https://github.com/yargs/yargs/commit/da75ea2))
|
|
324
|
-
* middleware added multiple times due to reference bug ([#1282](https://github.com/yargs/yargs/issues/1282)) ([64af518](https://github.com/yargs/yargs/commit/64af518))
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
### Chores
|
|
328
|
-
|
|
329
|
-
* ~drop Node 6 from testing matrix ([#1287](https://github.com/yargs/yargs/issues/1287)) ([ef16792](https://github.com/yargs/yargs/commit/ef16792))~
|
|
330
|
-
* _opting to not drop Node 6 support until April, [see](https://github.com/nodejs/Release)._
|
|
331
|
-
* update dependencies ([#1284](https://github.com/yargs/yargs/issues/1284)) ([f25de4f](https://github.com/yargs/yargs/commit/f25de4f))
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
### Features
|
|
335
|
-
|
|
336
|
-
* Add `.parserConfiguration()` method, deprecating package.json config ([#1262](https://github.com/yargs/yargs/issues/1262)) ([3c6869a](https://github.com/yargs/yargs/commit/3c6869a))
|
|
337
|
-
* adds config option for sorting command output ([#1256](https://github.com/yargs/yargs/issues/1256)) ([6916ce9](https://github.com/yargs/yargs/commit/6916ce9))
|
|
338
|
-
* 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))
|
|
339
|
-
* support promises in middleware ([f3a4e4f](https://github.com/yargs/yargs/commit/f3a4e4f))
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
### BREAKING CHANGES
|
|
86
|
+
* **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)
|
|
343
87
|
|
|
344
|
-
|
|
345
|
-
* dropping Node 6 which hits end of life in April 2019
|
|
346
|
-
* see [yargs-parser@12.0.0 CHANGELOG](https://github.com/yargs/yargs-parser/blob/master/CHANGELOG.md#breaking-changes)
|
|
347
|
-
* we now warn if the yargs stanza package.json is used.
|
|
88
|
+
[Older CHANGELOG Entries](https://github.com/yargs/yargs/blob/master/docs/CHANGELOG-historical.md)
|
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;
|