@oclif/core 4.7.0 → 4.7.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/lib/command.d.ts +1 -0
- package/lib/command.js +7 -0
- package/package.json +1 -1
package/lib/command.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export declare abstract class Command {
|
|
|
73
73
|
static usage: string | string[] | undefined;
|
|
74
74
|
protected debug: (...args: any[]) => void;
|
|
75
75
|
id: string | undefined;
|
|
76
|
+
parsed: boolean;
|
|
76
77
|
constructor(argv: string[], config: Config);
|
|
77
78
|
/**
|
|
78
79
|
* instantiate and run the command
|
package/lib/command.js
CHANGED
|
@@ -128,6 +128,7 @@ class Command {
|
|
|
128
128
|
static usage;
|
|
129
129
|
debug;
|
|
130
130
|
id;
|
|
131
|
+
parsed = false;
|
|
131
132
|
constructor(argv, config) {
|
|
132
133
|
this.argv = argv;
|
|
133
134
|
this.config = config;
|
|
@@ -189,6 +190,11 @@ class Command {
|
|
|
189
190
|
}
|
|
190
191
|
if (result && this.jsonEnabled())
|
|
191
192
|
this.logJson(this.toSuccessJson(result));
|
|
193
|
+
if (!this.parsed && !(0, util_2.isProd)()) {
|
|
194
|
+
process.emitWarning(`Command ${this.id} did not parse its arguments. Did you forget to call 'this.parse'?`, {
|
|
195
|
+
code: 'UnparsedCommand',
|
|
196
|
+
});
|
|
197
|
+
}
|
|
192
198
|
return result;
|
|
193
199
|
}
|
|
194
200
|
async catch(err) {
|
|
@@ -273,6 +279,7 @@ class Command {
|
|
|
273
279
|
this.argv = [...argvToParse];
|
|
274
280
|
const results = await Parser.parse(argvToParse, opts);
|
|
275
281
|
this.warnIfFlagDeprecated(results.flags ?? {});
|
|
282
|
+
this.parsed = true;
|
|
276
283
|
return results;
|
|
277
284
|
}
|
|
278
285
|
toErrorJson(err) {
|