@oclif/core 1.16.0 → 1.16.2
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 +14 -0
- package/lib/parser/parse.js +12 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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
|
+
### [1.16.2](https://github.com/oclif/core/compare/v1.16.1...v1.16.2) (2022-09-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* throw if unexpected argument ([#491](https://github.com/oclif/core/issues/491)) ([da6d20c](https://github.com/oclif/core/commit/da6d20c388e48f65560822cee141d4f2fc5955a5))
|
|
11
|
+
|
|
12
|
+
### [1.16.1](https://github.com/oclif/core/compare/v1.16.0...v1.16.1) (2022-09-08)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* support environment variables for boolean flags ([#488](https://github.com/oclif/core/issues/488)) ([#490](https://github.com/oclif/core/issues/490)) ([506945c](https://github.com/oclif/core/commit/506945c6ea2f8b75f0d56ad1f6e62a3717384a42)), closes [#487](https://github.com/oclif/core/issues/487)
|
|
18
|
+
|
|
5
19
|
## [1.16.0](https://github.com/oclif/core/compare/v1.15.0...v1.16.0) (2022-08-24)
|
|
6
20
|
|
|
7
21
|
|
package/lib/parser/parse.js
CHANGED
|
@@ -169,12 +169,18 @@ class Parser {
|
|
|
169
169
|
const flag = this.input.flags[k];
|
|
170
170
|
if (flags[k])
|
|
171
171
|
continue;
|
|
172
|
-
if (flag.
|
|
172
|
+
if (flag.env) {
|
|
173
173
|
const input = process.env[flag.env];
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
if (flag.type === 'option') {
|
|
175
|
+
if (input) {
|
|
176
|
+
this._validateOptions(flag, input);
|
|
177
|
+
// eslint-disable-next-line no-await-in-loop
|
|
178
|
+
flags[k] = await flag.parse(input, this.context, flag);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else if (flag.type === 'boolean') {
|
|
182
|
+
// eslint-disable-next-line no-negated-condition
|
|
183
|
+
flags[k] = input !== undefined ? ['true', 'TRUE', '1', 'yes', 'YES', 'y', 'Y'].includes(input) : false;
|
|
178
184
|
}
|
|
179
185
|
}
|
|
180
186
|
if (!(k in flags) && flag.default !== undefined) {
|
|
@@ -218,7 +224,7 @@ class Parser {
|
|
|
218
224
|
}
|
|
219
225
|
stdinRead = true;
|
|
220
226
|
}
|
|
221
|
-
if (!args[i] &&
|
|
227
|
+
if (!args[i] && arg?.default !== undefined) {
|
|
222
228
|
if (typeof arg.default === 'function') {
|
|
223
229
|
// eslint-disable-next-line no-await-in-loop
|
|
224
230
|
const f = await arg.default();
|