@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 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
 
@@ -17,6 +17,7 @@ export declare class Parser<T extends ParserInput, TFlags extends OutputFlags<T[
17
17
  }>;
18
18
  private _args;
19
19
  private _flags;
20
+ private _validateOptions;
20
21
  private _argv;
21
22
  private _debugOutput;
22
23
  private _debugInput;
@@ -153,9 +153,7 @@ class Parser {
153
153
  }
154
154
  else {
155
155
  const input = token.input;
156
- if (flag.options && !flag.options.includes(input)) {
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
- // eslint-disable-next-line no-await-in-loop
177
- if (input)
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;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "1.14.0",
4
+ "version": "1.14.1",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {