sim 2.2.22-preview.265.1 → 2.2.22-preview.267.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 +72 -60
- package/dist/runtime.js +72 -60
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21354,24 +21354,26 @@ async function localFile(path, override) {
|
|
|
21354
21354
|
}
|
|
21355
21355
|
|
|
21356
21356
|
// src/runtime/request.ts
|
|
21357
|
-
|
|
21357
|
+
var BODY_VARIANT_EXAMPLES = {
|
|
21358
|
+
array: `'[{"key":"value"}]'`,
|
|
21359
|
+
object: `'{"key":"value"}'`
|
|
21360
|
+
};
|
|
21361
|
+
function jsonShape(value) {
|
|
21358
21362
|
if (Array.isArray(value))
|
|
21359
|
-
return "
|
|
21360
|
-
if (value
|
|
21361
|
-
return "
|
|
21362
|
-
return
|
|
21363
|
+
return "array";
|
|
21364
|
+
if (isRecordLike(value))
|
|
21365
|
+
return "object";
|
|
21366
|
+
return;
|
|
21363
21367
|
}
|
|
21364
|
-
function bodyVariantShapeError(variant, parsed, variants) {
|
|
21368
|
+
function bodyVariantShapeError(variant, parsed, shape, variants) {
|
|
21365
21369
|
const flag = `--${variant.name}`;
|
|
21366
|
-
const
|
|
21367
|
-
const base = `${flag} must be a JSON ${variant.kind}, e.g. ${flag} ${
|
|
21368
|
-
if (variant.kind === "array" && parsed &&
|
|
21369
|
-
|
|
21370
|
-
return `${base} Pass the array under its "${variant.property}" key itself, not the object wrapping it.`;
|
|
21371
|
-
}
|
|
21370
|
+
const got = shape ? `a JSON ${shape}` : parsed === null ? "null" : `a JSON ${typeof parsed}`;
|
|
21371
|
+
const base = `${flag} must be a JSON ${variant.kind}, e.g. ${flag} ${BODY_VARIANT_EXAMPLES[variant.kind]}; got ${got}.`;
|
|
21372
|
+
if (variant.kind === "array" && isRecordLike(parsed) && Array.isArray(parsed[variant.property])) {
|
|
21373
|
+
return `${base} Pass the array under its "${variant.property}" key itself, not the object wrapping it.`;
|
|
21372
21374
|
}
|
|
21373
|
-
const other = variants.find((candidate) => candidate !== variant && candidate.kind ===
|
|
21374
|
-
return other
|
|
21375
|
+
const other = shape && variants.find((candidate) => candidate !== variant && candidate.kind === shape);
|
|
21376
|
+
return other ? `${base} For that shape use --${other.name}.` : base;
|
|
21375
21377
|
}
|
|
21376
21378
|
var PROFILE_INJECTED_FIELD = "workspaceId";
|
|
21377
21379
|
function isProfileWorkspacePath(commandSpec, param) {
|
|
@@ -21744,8 +21746,9 @@ async function buildRequest(operation, positional, flags, workspaceId) {
|
|
|
21744
21746
|
if (typeof raw !== "string")
|
|
21745
21747
|
throw new SimApiError(`--${variant.name} is required`, 0);
|
|
21746
21748
|
const parsed = await coerce(raw, { kind: variant.kind }, { json: true }, variant.name);
|
|
21747
|
-
|
|
21748
|
-
|
|
21749
|
+
const shape = jsonShape(parsed);
|
|
21750
|
+
if (shape !== variant.kind) {
|
|
21751
|
+
throw new SimApiError(bodyVariantShapeError(variant, parsed, shape, commandSpec.bodyVariants), 0);
|
|
21749
21752
|
}
|
|
21750
21753
|
return boundedRequest({
|
|
21751
21754
|
params,
|
|
@@ -22389,12 +22392,12 @@ function commandPath2(command) {
|
|
|
22389
22392
|
}
|
|
22390
22393
|
return names.join(" ");
|
|
22391
22394
|
}
|
|
22392
|
-
var UNKNOWN_OPTION_TOKEN = /^error: unknown option '(.+?)'/;
|
|
22393
22395
|
function looksLikeAnId(token) {
|
|
22394
|
-
return token.length > 2 && !token.startsWith("--") && /^-[
|
|
22396
|
+
return token.length > 2 && !token.startsWith("--") && /^-[\w-]+$/.test(token) && /[A-Z0-9]/.test(token);
|
|
22397
|
+
}
|
|
22398
|
+
function hasOwnAction(command) {
|
|
22399
|
+
return Boolean(command._actionHandler);
|
|
22395
22400
|
}
|
|
22396
|
-
var MISSING_OPTION_ERROR = /^error: required option '(.+?)' not specified/;
|
|
22397
|
-
var EXCESS_ARGUMENTS_ERROR = /^error: too many arguments/;
|
|
22398
22401
|
function longFlagSyntax(option) {
|
|
22399
22402
|
return option.flags.replace(/^-[A-Za-z], /, "");
|
|
22400
22403
|
}
|
|
@@ -22409,48 +22412,60 @@ function optionList(command) {
|
|
|
22409
22412
|
const flags = command.options.filter((option) => !option.hidden).map((option) => option.flags);
|
|
22410
22413
|
return flags.length > 0 ? `Options for ${commandPath2(command)}: ${flags.join(", ")}` : `${commandPath2(command)} takes no options.`;
|
|
22411
22414
|
}
|
|
22412
|
-
function
|
|
22413
|
-
|
|
22415
|
+
function unknownOptionToken(command) {
|
|
22416
|
+
return command.args.find((arg) => arg.length > 1 && arg.startsWith("-"));
|
|
22417
|
+
}
|
|
22418
|
+
function misplacedFlagValue(command) {
|
|
22419
|
+
const missing = command.options.filter((option) => option.mandatory && command.getOptionValue(option.attributeName()) === undefined);
|
|
22420
|
+
if (missing.length !== 1 || unknownOptionToken(command) !== undefined)
|
|
22421
|
+
return;
|
|
22414
22422
|
if (command.registeredArguments.some((argument) => argument.variadic))
|
|
22415
|
-
return
|
|
22416
|
-
|
|
22423
|
+
return;
|
|
22424
|
+
const extra = command.args.slice(command.registeredArguments.length);
|
|
22425
|
+
return extra.length === 1 ? { option: missing[0], value: extra[0] } : undefined;
|
|
22417
22426
|
}
|
|
22418
22427
|
function siblingsDeclaring(command, flag) {
|
|
22419
|
-
const
|
|
22420
|
-
|
|
22428
|
+
const parent = command.parent;
|
|
22429
|
+
if (!parent)
|
|
22430
|
+
return [];
|
|
22431
|
+
return parent.createHelp().visibleCommands(parent).filter((sibling) => sibling !== command && sibling.options.some((option) => !option.hidden && (option.long === flag || option.short === flag))).map((sibling) => ` ${commandPath2(sibling)} — ${sibling.description().split(`
|
|
22421
22432
|
`, 1)[0]}`);
|
|
22422
22433
|
}
|
|
22423
|
-
function parseErrorGuidance(command,
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
|
|
22434
|
+
function parseErrorGuidance(command, code) {
|
|
22435
|
+
switch (code) {
|
|
22436
|
+
case "commander.missingArgument":
|
|
22437
|
+
return [`Example: ${usageExample(command)}`];
|
|
22438
|
+
case "commander.missingMandatoryOptionValue": {
|
|
22439
|
+
const misplaced = misplacedFlagValue(command);
|
|
22440
|
+
const moved = misplaced ? [
|
|
22441
|
+
`"${misplaced.value}" was passed as a positional; pass it as ${misplaced.option.long ?? misplaced.option.short} "${misplaced.value}".`
|
|
22442
|
+
] : [];
|
|
22443
|
+
return [...moved, `Example: ${usageExample(command)}`];
|
|
22444
|
+
}
|
|
22445
|
+
case "commander.excessArguments":
|
|
22446
|
+
return [`Example: ${usageExample(command)}`, optionList(command)];
|
|
22447
|
+
case "commander.unknownOption": {
|
|
22448
|
+
const token = unknownOptionToken(command);
|
|
22449
|
+
if (!token)
|
|
22450
|
+
return [];
|
|
22451
|
+
if (looksLikeAnId(token) && command.registeredArguments.length > 0) {
|
|
22452
|
+
return [`Example: ${commandPath2(command)} -- ${token}`];
|
|
22453
|
+
}
|
|
22454
|
+
const flag = token.split("=", 1)[0];
|
|
22455
|
+
const owners = siblingsDeclaring(command, flag);
|
|
22456
|
+
return [
|
|
22457
|
+
optionList(command),
|
|
22458
|
+
...owners.length > 0 ? [`${flag} is an option of:`, ...owners] : []
|
|
22459
|
+
];
|
|
22460
|
+
}
|
|
22461
|
+
default:
|
|
22462
|
+
return [];
|
|
22442
22463
|
}
|
|
22443
|
-
const flag = token.split("=", 1)[0];
|
|
22444
|
-
const owners = siblingsDeclaring(command, flag);
|
|
22445
|
-
return [
|
|
22446
|
-
optionList(command),
|
|
22447
|
-
...owners.length > 0 ? [`${flag} is an option of:`, ...owners] : []
|
|
22448
|
-
];
|
|
22449
22464
|
}
|
|
22450
22465
|
function addParseErrorGuidance(command) {
|
|
22451
22466
|
const error = command.error.bind(command);
|
|
22452
22467
|
command.error = (message, options) => {
|
|
22453
|
-
const guidance = parseErrorGuidance(command,
|
|
22468
|
+
const guidance = parseErrorGuidance(command, options?.code);
|
|
22454
22469
|
return error(guidance.length > 0 ? `${message}
|
|
22455
22470
|
${guidance.join(`
|
|
22456
22471
|
`)}` : message, options);
|
|
@@ -22458,7 +22473,7 @@ ${guidance.join(`
|
|
|
22458
22473
|
}
|
|
22459
22474
|
function addParseErrorGuidanceToTree(program) {
|
|
22460
22475
|
const walk = (command) => {
|
|
22461
|
-
const parsesOwnArguments = command.commands.length === 0 ||
|
|
22476
|
+
const parsesOwnArguments = command.commands.length === 0 || hasOwnAction(command);
|
|
22462
22477
|
if (parsesOwnArguments || !command.parent)
|
|
22463
22478
|
addParseErrorGuidance(command);
|
|
22464
22479
|
for (const child of command.commands)
|
|
@@ -22498,7 +22513,7 @@ function assertNoReservedProgramFlags(program) {
|
|
|
22498
22513
|
function refuseHelpAfterUnknownCommand(program) {
|
|
22499
22514
|
const walk = (command) => {
|
|
22500
22515
|
const internals = command;
|
|
22501
|
-
const dispatchesOnly = command.commands.length > 0 && !
|
|
22516
|
+
const dispatchesOnly = command.commands.length > 0 && !hasOwnAction(command) && command.registeredArguments.length === 0;
|
|
22502
22517
|
if (dispatchesOnly) {
|
|
22503
22518
|
const known = new Set(["help"]);
|
|
22504
22519
|
for (const child of command.commands) {
|
|
@@ -22599,9 +22614,6 @@ function configureOperation(command, operation, spec) {
|
|
|
22599
22614
|
}));
|
|
22600
22615
|
return command;
|
|
22601
22616
|
}
|
|
22602
|
-
function buildLeaf(operation, spec, leafName) {
|
|
22603
|
-
return configureOperation(new Command(leafName), operation, spec);
|
|
22604
|
-
}
|
|
22605
22617
|
function addRenamedCommand(groups, operation, spec, from, to) {
|
|
22606
22618
|
const segments = from.split(" ");
|
|
22607
22619
|
const [groupName, ...rest] = segments;
|
|
@@ -22611,7 +22623,7 @@ function addRenamedCommand(groups, operation, spec, from, to) {
|
|
|
22611
22623
|
for (const segment of rest.slice(0, -1)) {
|
|
22612
22624
|
parent = nestedGroup(parent, segment, { hidden: true });
|
|
22613
22625
|
}
|
|
22614
|
-
const leaf =
|
|
22626
|
+
const leaf = configureOperation(new Command(rest[rest.length - 1]), operation, spec);
|
|
22615
22627
|
leaf.hook("preAction", () => warnRenamedCommand(from, to));
|
|
22616
22628
|
addSubcommand(parent, leaf, { hidden: true });
|
|
22617
22629
|
}
|
|
@@ -22655,12 +22667,12 @@ function addLeafCommand(groups, operation, spec, segments) {
|
|
|
22655
22667
|
for (const segment of rest.slice(0, -1)) {
|
|
22656
22668
|
parent = nestedGroup(parent, segment);
|
|
22657
22669
|
}
|
|
22658
|
-
parent.addCommand(
|
|
22670
|
+
parent.addCommand(configureOperation(new Command(rest[rest.length - 1]), operation, spec), {
|
|
22659
22671
|
isDefault: spec.defaultSubcommand === true
|
|
22660
22672
|
});
|
|
22661
22673
|
return;
|
|
22662
22674
|
}
|
|
22663
|
-
group.addCommand(
|
|
22675
|
+
group.addCommand(configureOperation(new Command(rest[0]), operation, spec), {
|
|
22664
22676
|
isDefault: spec.defaultSubcommand === true
|
|
22665
22677
|
});
|
|
22666
22678
|
}
|
package/dist/runtime.js
CHANGED
|
@@ -21403,24 +21403,26 @@ async function localFile(path, override) {
|
|
|
21403
21403
|
}
|
|
21404
21404
|
|
|
21405
21405
|
// src/runtime/request.ts
|
|
21406
|
-
|
|
21406
|
+
var BODY_VARIANT_EXAMPLES = {
|
|
21407
|
+
array: `'[{"key":"value"}]'`,
|
|
21408
|
+
object: `'{"key":"value"}'`
|
|
21409
|
+
};
|
|
21410
|
+
function jsonShape(value) {
|
|
21407
21411
|
if (Array.isArray(value))
|
|
21408
|
-
return "
|
|
21409
|
-
if (value
|
|
21410
|
-
return "
|
|
21411
|
-
return
|
|
21412
|
+
return "array";
|
|
21413
|
+
if (isRecordLike(value))
|
|
21414
|
+
return "object";
|
|
21415
|
+
return;
|
|
21412
21416
|
}
|
|
21413
|
-
function bodyVariantShapeError(variant, parsed, variants) {
|
|
21417
|
+
function bodyVariantShapeError(variant, parsed, shape, variants) {
|
|
21414
21418
|
const flag = `--${variant.name}`;
|
|
21415
|
-
const
|
|
21416
|
-
const base = `${flag} must be a JSON ${variant.kind}, e.g. ${flag} ${
|
|
21417
|
-
if (variant.kind === "array" && parsed &&
|
|
21418
|
-
|
|
21419
|
-
return `${base} Pass the array under its "${variant.property}" key itself, not the object wrapping it.`;
|
|
21420
|
-
}
|
|
21419
|
+
const got = shape ? `a JSON ${shape}` : parsed === null ? "null" : `a JSON ${typeof parsed}`;
|
|
21420
|
+
const base = `${flag} must be a JSON ${variant.kind}, e.g. ${flag} ${BODY_VARIANT_EXAMPLES[variant.kind]}; got ${got}.`;
|
|
21421
|
+
if (variant.kind === "array" && isRecordLike(parsed) && Array.isArray(parsed[variant.property])) {
|
|
21422
|
+
return `${base} Pass the array under its "${variant.property}" key itself, not the object wrapping it.`;
|
|
21421
21423
|
}
|
|
21422
|
-
const other = variants.find((candidate) => candidate !== variant && candidate.kind ===
|
|
21423
|
-
return other
|
|
21424
|
+
const other = shape && variants.find((candidate) => candidate !== variant && candidate.kind === shape);
|
|
21425
|
+
return other ? `${base} For that shape use --${other.name}.` : base;
|
|
21424
21426
|
}
|
|
21425
21427
|
var PROFILE_INJECTED_FIELD = "workspaceId";
|
|
21426
21428
|
function isProfileWorkspacePath(commandSpec, param) {
|
|
@@ -21793,8 +21795,9 @@ async function buildRequest(operation, positional, flags, workspaceId) {
|
|
|
21793
21795
|
if (typeof raw !== "string")
|
|
21794
21796
|
throw new SimApiError(`--${variant.name} is required`, 0);
|
|
21795
21797
|
const parsed = await coerce(raw, { kind: variant.kind }, { json: true }, variant.name);
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
+
const shape = jsonShape(parsed);
|
|
21799
|
+
if (shape !== variant.kind) {
|
|
21800
|
+
throw new SimApiError(bodyVariantShapeError(variant, parsed, shape, commandSpec.bodyVariants), 0);
|
|
21798
21801
|
}
|
|
21799
21802
|
return boundedRequest({
|
|
21800
21803
|
params,
|
|
@@ -22438,12 +22441,12 @@ function commandPath2(command) {
|
|
|
22438
22441
|
}
|
|
22439
22442
|
return names.join(" ");
|
|
22440
22443
|
}
|
|
22441
|
-
var UNKNOWN_OPTION_TOKEN = /^error: unknown option '(.+?)'/;
|
|
22442
22444
|
function looksLikeAnId(token) {
|
|
22443
|
-
return token.length > 2 && !token.startsWith("--") && /^-[
|
|
22445
|
+
return token.length > 2 && !token.startsWith("--") && /^-[\w-]+$/.test(token) && /[A-Z0-9]/.test(token);
|
|
22446
|
+
}
|
|
22447
|
+
function hasOwnAction(command) {
|
|
22448
|
+
return Boolean(command._actionHandler);
|
|
22444
22449
|
}
|
|
22445
|
-
var MISSING_OPTION_ERROR = /^error: required option '(.+?)' not specified/;
|
|
22446
|
-
var EXCESS_ARGUMENTS_ERROR = /^error: too many arguments/;
|
|
22447
22450
|
function longFlagSyntax(option) {
|
|
22448
22451
|
return option.flags.replace(/^-[A-Za-z], /, "");
|
|
22449
22452
|
}
|
|
@@ -22458,48 +22461,60 @@ function optionList(command) {
|
|
|
22458
22461
|
const flags = command.options.filter((option) => !option.hidden).map((option) => option.flags);
|
|
22459
22462
|
return flags.length > 0 ? `Options for ${commandPath2(command)}: ${flags.join(", ")}` : `${commandPath2(command)} takes no options.`;
|
|
22460
22463
|
}
|
|
22461
|
-
function
|
|
22462
|
-
|
|
22464
|
+
function unknownOptionToken(command) {
|
|
22465
|
+
return command.args.find((arg) => arg.length > 1 && arg.startsWith("-"));
|
|
22466
|
+
}
|
|
22467
|
+
function misplacedFlagValue(command) {
|
|
22468
|
+
const missing = command.options.filter((option) => option.mandatory && command.getOptionValue(option.attributeName()) === undefined);
|
|
22469
|
+
if (missing.length !== 1 || unknownOptionToken(command) !== undefined)
|
|
22470
|
+
return;
|
|
22463
22471
|
if (command.registeredArguments.some((argument) => argument.variadic))
|
|
22464
|
-
return
|
|
22465
|
-
|
|
22472
|
+
return;
|
|
22473
|
+
const extra = command.args.slice(command.registeredArguments.length);
|
|
22474
|
+
return extra.length === 1 ? { option: missing[0], value: extra[0] } : undefined;
|
|
22466
22475
|
}
|
|
22467
22476
|
function siblingsDeclaring(command, flag) {
|
|
22468
|
-
const
|
|
22469
|
-
|
|
22477
|
+
const parent = command.parent;
|
|
22478
|
+
if (!parent)
|
|
22479
|
+
return [];
|
|
22480
|
+
return parent.createHelp().visibleCommands(parent).filter((sibling) => sibling !== command && sibling.options.some((option) => !option.hidden && (option.long === flag || option.short === flag))).map((sibling) => ` ${commandPath2(sibling)} — ${sibling.description().split(`
|
|
22470
22481
|
`, 1)[0]}`);
|
|
22471
22482
|
}
|
|
22472
|
-
function parseErrorGuidance(command,
|
|
22473
|
-
|
|
22474
|
-
|
|
22475
|
-
|
|
22476
|
-
|
|
22477
|
-
|
|
22478
|
-
|
|
22479
|
-
|
|
22480
|
-
|
|
22481
|
-
|
|
22482
|
-
|
|
22483
|
-
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22488
|
-
|
|
22489
|
-
|
|
22490
|
-
|
|
22483
|
+
function parseErrorGuidance(command, code) {
|
|
22484
|
+
switch (code) {
|
|
22485
|
+
case "commander.missingArgument":
|
|
22486
|
+
return [`Example: ${usageExample(command)}`];
|
|
22487
|
+
case "commander.missingMandatoryOptionValue": {
|
|
22488
|
+
const misplaced = misplacedFlagValue(command);
|
|
22489
|
+
const moved = misplaced ? [
|
|
22490
|
+
`"${misplaced.value}" was passed as a positional; pass it as ${misplaced.option.long ?? misplaced.option.short} "${misplaced.value}".`
|
|
22491
|
+
] : [];
|
|
22492
|
+
return [...moved, `Example: ${usageExample(command)}`];
|
|
22493
|
+
}
|
|
22494
|
+
case "commander.excessArguments":
|
|
22495
|
+
return [`Example: ${usageExample(command)}`, optionList(command)];
|
|
22496
|
+
case "commander.unknownOption": {
|
|
22497
|
+
const token = unknownOptionToken(command);
|
|
22498
|
+
if (!token)
|
|
22499
|
+
return [];
|
|
22500
|
+
if (looksLikeAnId(token) && command.registeredArguments.length > 0) {
|
|
22501
|
+
return [`Example: ${commandPath2(command)} -- ${token}`];
|
|
22502
|
+
}
|
|
22503
|
+
const flag = token.split("=", 1)[0];
|
|
22504
|
+
const owners = siblingsDeclaring(command, flag);
|
|
22505
|
+
return [
|
|
22506
|
+
optionList(command),
|
|
22507
|
+
...owners.length > 0 ? [`${flag} is an option of:`, ...owners] : []
|
|
22508
|
+
];
|
|
22509
|
+
}
|
|
22510
|
+
default:
|
|
22511
|
+
return [];
|
|
22491
22512
|
}
|
|
22492
|
-
const flag = token.split("=", 1)[0];
|
|
22493
|
-
const owners = siblingsDeclaring(command, flag);
|
|
22494
|
-
return [
|
|
22495
|
-
optionList(command),
|
|
22496
|
-
...owners.length > 0 ? [`${flag} is an option of:`, ...owners] : []
|
|
22497
|
-
];
|
|
22498
22513
|
}
|
|
22499
22514
|
function addParseErrorGuidance(command) {
|
|
22500
22515
|
const error = command.error.bind(command);
|
|
22501
22516
|
command.error = (message, options) => {
|
|
22502
|
-
const guidance = parseErrorGuidance(command,
|
|
22517
|
+
const guidance = parseErrorGuidance(command, options?.code);
|
|
22503
22518
|
return error(guidance.length > 0 ? `${message}
|
|
22504
22519
|
${guidance.join(`
|
|
22505
22520
|
`)}` : message, options);
|
|
@@ -22507,7 +22522,7 @@ ${guidance.join(`
|
|
|
22507
22522
|
}
|
|
22508
22523
|
function addParseErrorGuidanceToTree(program) {
|
|
22509
22524
|
const walk = (command) => {
|
|
22510
|
-
const parsesOwnArguments = command.commands.length === 0 ||
|
|
22525
|
+
const parsesOwnArguments = command.commands.length === 0 || hasOwnAction(command);
|
|
22511
22526
|
if (parsesOwnArguments || !command.parent)
|
|
22512
22527
|
addParseErrorGuidance(command);
|
|
22513
22528
|
for (const child of command.commands)
|
|
@@ -22547,7 +22562,7 @@ function assertNoReservedProgramFlags(program) {
|
|
|
22547
22562
|
function refuseHelpAfterUnknownCommand(program) {
|
|
22548
22563
|
const walk = (command) => {
|
|
22549
22564
|
const internals = command;
|
|
22550
|
-
const dispatchesOnly = command.commands.length > 0 && !
|
|
22565
|
+
const dispatchesOnly = command.commands.length > 0 && !hasOwnAction(command) && command.registeredArguments.length === 0;
|
|
22551
22566
|
if (dispatchesOnly) {
|
|
22552
22567
|
const known = new Set(["help"]);
|
|
22553
22568
|
for (const child of command.commands) {
|
|
@@ -22648,9 +22663,6 @@ function configureOperation(command, operation, spec) {
|
|
|
22648
22663
|
}));
|
|
22649
22664
|
return command;
|
|
22650
22665
|
}
|
|
22651
|
-
function buildLeaf(operation, spec, leafName) {
|
|
22652
|
-
return configureOperation(new Command(leafName), operation, spec);
|
|
22653
|
-
}
|
|
22654
22666
|
function addRenamedCommand(groups, operation, spec, from, to) {
|
|
22655
22667
|
const segments = from.split(" ");
|
|
22656
22668
|
const [groupName, ...rest] = segments;
|
|
@@ -22660,7 +22672,7 @@ function addRenamedCommand(groups, operation, spec, from, to) {
|
|
|
22660
22672
|
for (const segment of rest.slice(0, -1)) {
|
|
22661
22673
|
parent = nestedGroup(parent, segment, { hidden: true });
|
|
22662
22674
|
}
|
|
22663
|
-
const leaf =
|
|
22675
|
+
const leaf = configureOperation(new Command(rest[rest.length - 1]), operation, spec);
|
|
22664
22676
|
leaf.hook("preAction", () => warnRenamedCommand(from, to));
|
|
22665
22677
|
addSubcommand(parent, leaf, { hidden: true });
|
|
22666
22678
|
}
|
|
@@ -22704,12 +22716,12 @@ function addLeafCommand(groups, operation, spec, segments) {
|
|
|
22704
22716
|
for (const segment of rest.slice(0, -1)) {
|
|
22705
22717
|
parent = nestedGroup(parent, segment);
|
|
22706
22718
|
}
|
|
22707
|
-
parent.addCommand(
|
|
22719
|
+
parent.addCommand(configureOperation(new Command(rest[rest.length - 1]), operation, spec), {
|
|
22708
22720
|
isDefault: spec.defaultSubcommand === true
|
|
22709
22721
|
});
|
|
22710
22722
|
return;
|
|
22711
22723
|
}
|
|
22712
|
-
group.addCommand(
|
|
22724
|
+
group.addCommand(configureOperation(new Command(rest[0]), operation, spec), {
|
|
22713
22725
|
isDefault: spec.defaultSubcommand === true
|
|
22714
22726
|
});
|
|
22715
22727
|
}
|