@oclif/core 1.3.3 → 1.3.6
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 +21 -0
- package/lib/command.d.ts +3 -1
- package/lib/parser/parse.js +1 -5
- package/lib/parser/validate.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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.3.6](https://github.com/oclif/core/compare/v1.3.5...v1.3.6) (2022-02-28)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* parsing the default is wrong types ([ba08723](https://github.com/oclif/core/commit/ba087237773e6f4b3649d03dc88f693a22681de9))
|
|
11
|
+
|
|
12
|
+
### [1.3.5](https://github.com/oclif/core/compare/v1.3.4...v1.3.5) (2022-02-25)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* print valid flag values in error message when using `exactlyOne` ([#349](https://github.com/oclif/core/issues/349)) ([ddcaeb2](https://github.com/oclif/core/commit/ddcaeb2f9b690d9b92dd0ac4937b6399f606adfa))
|
|
18
|
+
|
|
19
|
+
### [1.3.4](https://github.com/oclif/core/compare/v1.3.3...v1.3.4) (2022-02-11)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* use error type instead of record ([#371](https://github.com/oclif/core/issues/371)) ([136ffe0](https://github.com/oclif/core/commit/136ffe06fe3dc3ddb6d018ced2b2cfaa9399d943))
|
|
25
|
+
|
|
5
26
|
### [1.3.3](https://github.com/oclif/core/compare/v1.3.2...v1.3.3) (2022-02-09)
|
|
6
27
|
|
|
7
28
|
|
package/lib/command.d.ts
CHANGED
|
@@ -93,7 +93,9 @@ export default abstract class Command {
|
|
|
93
93
|
protected parse<F, A extends {
|
|
94
94
|
[name: string]: any;
|
|
95
95
|
}>(options?: Interfaces.Input<F>, argv?: string[]): Promise<Interfaces.ParserOutput<F, A>>;
|
|
96
|
-
protected catch(err:
|
|
96
|
+
protected catch(err: Error & {
|
|
97
|
+
exitCode?: number;
|
|
98
|
+
}): Promise<any>;
|
|
97
99
|
protected finally(_: Error | undefined): Promise<any>;
|
|
98
100
|
protected toSuccessJson(result: unknown): any;
|
|
99
101
|
protected toErrorJson(err: unknown): any;
|
package/lib/parser/parse.js
CHANGED
|
@@ -181,11 +181,7 @@ class Parser {
|
|
|
181
181
|
this.metaData.flags[k] = { setFromDefault: true };
|
|
182
182
|
// eslint-disable-next-line no-await-in-loop
|
|
183
183
|
const defaultValue = (typeof flag.default === 'function' ? await flag.default({ options: flag, flags, ...this.context }) : flag.default);
|
|
184
|
-
|
|
185
|
-
// eslint-disable-next-line no-await-in-loop
|
|
186
|
-
await flag.parse(defaultValue, this.context) :
|
|
187
|
-
defaultValue;
|
|
188
|
-
flags[k] = parsedValue;
|
|
184
|
+
flags[k] = defaultValue;
|
|
189
185
|
}
|
|
190
186
|
}
|
|
191
187
|
return flags;
|
package/lib/parser/validate.js
CHANGED
|
@@ -30,6 +30,7 @@ function validate(parse) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
function validateAcrossFlags(flag) {
|
|
33
|
+
var _a;
|
|
33
34
|
const intersection = Object.entries(parse.input.flags)
|
|
34
35
|
.map(entry => entry[0]) // array of flag names
|
|
35
36
|
.filter(flagName => parse.output.flags[flagName] !== undefined) // with values
|
|
@@ -37,8 +38,8 @@ function validate(parse) {
|
|
|
37
38
|
if (intersection.length === 0) {
|
|
38
39
|
// the command's exactlyOne may or may not include itself, so we'll use Set to add + de-dupe
|
|
39
40
|
throw new errors_1.CLIError(`Exactly one of the following must be provided: ${[
|
|
40
|
-
...new Set(
|
|
41
|
-
].join(',')}`);
|
|
41
|
+
...new Set((_a = flag.exactlyOne) === null || _a === void 0 ? void 0 : _a.map(flag => `--${flag}`)),
|
|
42
|
+
].join(', ')}`);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
function validateFlags() {
|