@oclif/core 3.15.1 → 3.17.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.
|
@@ -214,10 +214,11 @@ export type OptionFlagProps = FlagProps & {
|
|
|
214
214
|
*/
|
|
215
215
|
delimiter?: ',';
|
|
216
216
|
/**
|
|
217
|
-
* Allow input value to be read from stdin
|
|
217
|
+
* Allow input value to be read from stdin if the provided value is `-`.
|
|
218
|
+
* If set to `only`, the flag will only accept input from stdin.
|
|
218
219
|
* Should only be used on one flag at a time.
|
|
219
220
|
*/
|
|
220
|
-
allowStdin?: boolean;
|
|
221
|
+
allowStdin?: boolean | 'only';
|
|
221
222
|
};
|
|
222
223
|
export type FlagParserContext = Command & {
|
|
223
224
|
token: FlagToken;
|
package/lib/parser/parse.js
CHANGED
|
@@ -111,6 +111,9 @@ class Parser {
|
|
|
111
111
|
if (typeof input !== 'string' || this.findFlag(input).name) {
|
|
112
112
|
throw new errors_1.CLIError(`Flag --${name} expects a value`);
|
|
113
113
|
}
|
|
114
|
+
if (flag.allowStdin === 'only' && input !== '-') {
|
|
115
|
+
throw new errors_1.CLIError(`Flag --${name} can only be read from stdin. The value must be "-".`);
|
|
116
|
+
}
|
|
114
117
|
if (flag.allowStdin && input === '-') {
|
|
115
118
|
const stdin = await (0, exports.readStdin)();
|
|
116
119
|
if (stdin) {
|
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": "3.
|
|
4
|
+
"version": "3.17.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/mocha": "^10.0.6",
|
|
54
54
|
"@types/node": "^18",
|
|
55
55
|
"@types/node-notifier": "^8.0.2",
|
|
56
|
-
"@types/pnpapi": "^0.0.
|
|
56
|
+
"@types/pnpapi": "^0.0.5",
|
|
57
57
|
"@types/slice-ansi": "^4.0.0",
|
|
58
58
|
"@types/strip-ansi": "^5.2.1",
|
|
59
59
|
"@types/supports-color": "^8.1.1",
|