sim 2.2.9-preview.209.1 → 2.2.9-preview.210.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/dist/index.js +10 -6
- package/dist/runtime.js +10 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21303,7 +21303,7 @@ var UNKNOWN_OPTION_TOKEN = /^error: unknown option '(.+?)'/;
|
|
|
21303
21303
|
function looksLikeAnId(token) {
|
|
21304
21304
|
return token.length > 2 && !token.startsWith("--") && /^-[A-Za-z0-9_-]*[A-Z0-9][A-Za-z0-9_-]*$/.test(token);
|
|
21305
21305
|
}
|
|
21306
|
-
function
|
|
21306
|
+
function addParseErrorGuidance(command) {
|
|
21307
21307
|
const outputError = command.configureOutput().outputError;
|
|
21308
21308
|
if (!outputError)
|
|
21309
21309
|
throw new Error("Commander output formatter is not configured");
|
|
@@ -21317,12 +21317,16 @@ function addArgumentExamples(command) {
|
|
|
21317
21317
|
`);
|
|
21318
21318
|
return;
|
|
21319
21319
|
}
|
|
21320
|
-
if (command.registeredArguments.length === 0)
|
|
21321
|
-
return;
|
|
21322
21320
|
const token = UNKNOWN_OPTION_TOKEN.exec(message)?.[1];
|
|
21323
|
-
if (!token
|
|
21321
|
+
if (!token)
|
|
21322
|
+
return;
|
|
21323
|
+
if (looksLikeAnId(token) && command.registeredArguments.length > 0) {
|
|
21324
|
+
write(`Example: ${commandPath(command)} -- ${token}
|
|
21325
|
+
`);
|
|
21324
21326
|
return;
|
|
21325
|
-
|
|
21327
|
+
}
|
|
21328
|
+
const flags = command.options.filter((option) => !option.hidden).map((option) => option.flags);
|
|
21329
|
+
write(`Options for ${commandPath(command)}: ${flags.join(", ")}
|
|
21326
21330
|
`);
|
|
21327
21331
|
}
|
|
21328
21332
|
});
|
|
@@ -21449,7 +21453,7 @@ function configureOperation(command, operation, spec) {
|
|
|
21449
21453
|
return command;
|
|
21450
21454
|
}
|
|
21451
21455
|
function buildLeaf(operation, spec, leafName) {
|
|
21452
|
-
return
|
|
21456
|
+
return addParseErrorGuidance(configureOperation(new Command(leafName), operation, spec));
|
|
21453
21457
|
}
|
|
21454
21458
|
function addRenamedCommand(groups, operation, spec, from, to) {
|
|
21455
21459
|
const segments = from.split(" ");
|
package/dist/runtime.js
CHANGED
|
@@ -21352,7 +21352,7 @@ var UNKNOWN_OPTION_TOKEN = /^error: unknown option '(.+?)'/;
|
|
|
21352
21352
|
function looksLikeAnId(token) {
|
|
21353
21353
|
return token.length > 2 && !token.startsWith("--") && /^-[A-Za-z0-9_-]*[A-Z0-9][A-Za-z0-9_-]*$/.test(token);
|
|
21354
21354
|
}
|
|
21355
|
-
function
|
|
21355
|
+
function addParseErrorGuidance(command) {
|
|
21356
21356
|
const outputError = command.configureOutput().outputError;
|
|
21357
21357
|
if (!outputError)
|
|
21358
21358
|
throw new Error("Commander output formatter is not configured");
|
|
@@ -21366,12 +21366,16 @@ function addArgumentExamples(command) {
|
|
|
21366
21366
|
`);
|
|
21367
21367
|
return;
|
|
21368
21368
|
}
|
|
21369
|
-
if (command.registeredArguments.length === 0)
|
|
21370
|
-
return;
|
|
21371
21369
|
const token = UNKNOWN_OPTION_TOKEN.exec(message)?.[1];
|
|
21372
|
-
if (!token
|
|
21370
|
+
if (!token)
|
|
21371
|
+
return;
|
|
21372
|
+
if (looksLikeAnId(token) && command.registeredArguments.length > 0) {
|
|
21373
|
+
write(`Example: ${commandPath(command)} -- ${token}
|
|
21374
|
+
`);
|
|
21373
21375
|
return;
|
|
21374
|
-
|
|
21376
|
+
}
|
|
21377
|
+
const flags = command.options.filter((option) => !option.hidden).map((option) => option.flags);
|
|
21378
|
+
write(`Options for ${commandPath(command)}: ${flags.join(", ")}
|
|
21375
21379
|
`);
|
|
21376
21380
|
}
|
|
21377
21381
|
});
|
|
@@ -21498,7 +21502,7 @@ function configureOperation(command, operation, spec) {
|
|
|
21498
21502
|
return command;
|
|
21499
21503
|
}
|
|
21500
21504
|
function buildLeaf(operation, spec, leafName) {
|
|
21501
|
-
return
|
|
21505
|
+
return addParseErrorGuidance(configureOperation(new Command(leafName), operation, spec));
|
|
21502
21506
|
}
|
|
21503
21507
|
function addRenamedCommand(groups, operation, spec, from, to) {
|
|
21504
21508
|
const segments = from.split(" ");
|