@oclif/core 1.14.0 → 1.14.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 +7 -0
- package/lib/parser/parse.d.ts +1 -0
- package/lib/parser/parse.js +9 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.14.1](https://github.com/oclif/core/compare/v1.14.0...v1.14.1) (2022-08-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* parser doesn't validate against options parameter if the value is provided through a env var ([#474](https://github.com/oclif/core/issues/474)) ([fe6dfea](https://github.com/oclif/core/commit/fe6dfea0bcc5cae69c91962430996670decf7887))
|
|
11
|
+
|
|
5
12
|
## [1.14.0](https://github.com/oclif/core/compare/v1.13.11...v1.14.0) (2022-08-16)
|
|
6
13
|
|
|
7
14
|
|
package/lib/parser/parse.d.ts
CHANGED
package/lib/parser/parse.js
CHANGED
|
@@ -153,9 +153,7 @@ class Parser {
|
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
155
155
|
const input = token.input;
|
|
156
|
-
|
|
157
|
-
throw new m.errors.FlagInvalidOptionError(flag, input);
|
|
158
|
-
}
|
|
156
|
+
this._validateOptions(flag, input);
|
|
159
157
|
// eslint-disable-next-line no-await-in-loop
|
|
160
158
|
const value = flag.parse ? await flag.parse(input, this.context) : input;
|
|
161
159
|
if (flag.multiple) {
|
|
@@ -173,9 +171,11 @@ class Parser {
|
|
|
173
171
|
continue;
|
|
174
172
|
if (flag.type === 'option' && flag.env) {
|
|
175
173
|
const input = process.env[flag.env];
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
if (input) {
|
|
175
|
+
this._validateOptions(flag, input);
|
|
176
|
+
// eslint-disable-next-line no-await-in-loop
|
|
178
177
|
flags[k] = await flag.parse(input, this.context);
|
|
178
|
+
}
|
|
179
179
|
}
|
|
180
180
|
if (!(k in flags) && flag.default !== undefined) {
|
|
181
181
|
this.metaData.flags[k] = { setFromDefault: true };
|
|
@@ -186,6 +186,10 @@ class Parser {
|
|
|
186
186
|
}
|
|
187
187
|
return flags;
|
|
188
188
|
}
|
|
189
|
+
_validateOptions(flag, input) {
|
|
190
|
+
if (flag.options && !flag.options.includes(input))
|
|
191
|
+
throw new m.errors.FlagInvalidOptionError(flag, input);
|
|
192
|
+
}
|
|
189
193
|
async _argv() {
|
|
190
194
|
const args = [];
|
|
191
195
|
const tokens = this._argTokens;
|