@oclif/core 1.13.11 → 1.14.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 +7 -0
- package/lib/parser/flags.js +15 -3
- 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.0](https://github.com/oclif/core/compare/v1.13.11...v1.14.0) (2022-08-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* all oclif flag types support custom parsers ([ad86faf](https://github.com/oclif/core/commit/ad86faf08f7a6d7984afe356819df458aaf04674))
|
|
11
|
+
|
|
5
12
|
### [1.13.11](https://github.com/oclif/core/compare/v1.13.10...v1.13.11) (2022-08-16)
|
|
6
13
|
|
|
7
14
|
|
package/lib/parser/flags.js
CHANGED
|
@@ -37,7 +37,7 @@ function integer(opts = {}) {
|
|
|
37
37
|
throw new Error(`Expected an integer greater than or equal to ${opts.min} but received: ${input}`);
|
|
38
38
|
if (opts.max !== undefined && num > opts.max)
|
|
39
39
|
throw new Error(`Expected an integer less than or equal to ${opts.max} but received: ${input}`);
|
|
40
|
-
return num;
|
|
40
|
+
return opts.parse ? opts.parse(input, 1) : num;
|
|
41
41
|
},
|
|
42
42
|
})();
|
|
43
43
|
}
|
|
@@ -45,14 +45,26 @@ exports.integer = integer;
|
|
|
45
45
|
function directory(opts = {}) {
|
|
46
46
|
return build({
|
|
47
47
|
...opts,
|
|
48
|
-
parse: async (input) =>
|
|
48
|
+
parse: async (input) => {
|
|
49
|
+
if (opts.exists) {
|
|
50
|
+
// 2nd "context" arg is required but unused
|
|
51
|
+
return opts.parse ? opts.parse(await dirExists(input), true) : dirExists(input);
|
|
52
|
+
}
|
|
53
|
+
return opts.parse ? opts.parse(input, true) : input;
|
|
54
|
+
},
|
|
49
55
|
})();
|
|
50
56
|
}
|
|
51
57
|
exports.directory = directory;
|
|
52
58
|
function file(opts = {}) {
|
|
53
59
|
return build({
|
|
54
60
|
...opts,
|
|
55
|
-
parse: async (input) =>
|
|
61
|
+
parse: async (input) => {
|
|
62
|
+
if (opts.exists) {
|
|
63
|
+
// 2nd "context" arg is required but unused
|
|
64
|
+
return opts.parse ? opts.parse(await fileExists(input), true) : fileExists(input);
|
|
65
|
+
}
|
|
66
|
+
return opts.parse ? opts.parse(input, true) : input;
|
|
67
|
+
},
|
|
56
68
|
})();
|
|
57
69
|
}
|
|
58
70
|
exports.file = file;
|