@robinmordasiewicz/f5xc-xcsh 1.0.91-2601032317 → 1.0.91-2601040044
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 +104 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46628,7 +46628,7 @@ import { homedir as homedir2 } from "os";
|
|
|
46628
46628
|
// src/config/paths.ts
|
|
46629
46629
|
import { homedir } from "os";
|
|
46630
46630
|
import { join } from "path";
|
|
46631
|
-
var APP_NAME = "
|
|
46631
|
+
var APP_NAME = "f5xc";
|
|
46632
46632
|
function getConfigDir() {
|
|
46633
46633
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
46634
46634
|
if (xdgConfig) {
|
|
@@ -47052,8 +47052,8 @@ function getLogoModeFromEnv(envPrefix) {
|
|
|
47052
47052
|
var CLI_NAME = "xcsh";
|
|
47053
47053
|
var CLI_FULL_NAME = "F5 Distributed Cloud Shell";
|
|
47054
47054
|
function getVersion() {
|
|
47055
|
-
if ("v1.0.91-
|
|
47056
|
-
return "v1.0.91-
|
|
47055
|
+
if ("v1.0.91-2601040044") {
|
|
47056
|
+
return "v1.0.91-2601040044";
|
|
47057
47057
|
}
|
|
47058
47058
|
if (process.env.XCSH_VERSION) {
|
|
47059
47059
|
return process.env.XCSH_VERSION;
|
|
@@ -143334,10 +143334,30 @@ var DomainRegistry = class {
|
|
|
143334
143334
|
const cmdArgs = restArgs.slice(1);
|
|
143335
143335
|
const cmd2 = subgroup.commands.get(cmdName);
|
|
143336
143336
|
if (cmd2) {
|
|
143337
|
+
const commandPath = `${domainName} ${firstArg} ${cmdName}`;
|
|
143338
|
+
const validationError = this.validateCommandArgs(
|
|
143339
|
+
cmd2,
|
|
143340
|
+
cmdArgs,
|
|
143341
|
+
subgroup.commands,
|
|
143342
|
+
commandPath
|
|
143343
|
+
);
|
|
143344
|
+
if (validationError) {
|
|
143345
|
+
return validationError;
|
|
143346
|
+
}
|
|
143337
143347
|
return cmd2.execute(cmdArgs, session);
|
|
143338
143348
|
}
|
|
143339
143349
|
for (const [, command] of subgroup.commands) {
|
|
143340
143350
|
if (command.aliases?.includes(cmdName)) {
|
|
143351
|
+
const commandPath = `${domainName} ${firstArg} ${command.name}`;
|
|
143352
|
+
const validationError = this.validateCommandArgs(
|
|
143353
|
+
command,
|
|
143354
|
+
cmdArgs,
|
|
143355
|
+
subgroup.commands,
|
|
143356
|
+
commandPath
|
|
143357
|
+
);
|
|
143358
|
+
if (validationError) {
|
|
143359
|
+
return validationError;
|
|
143360
|
+
}
|
|
143341
143361
|
return command.execute(cmdArgs, session);
|
|
143342
143362
|
}
|
|
143343
143363
|
}
|
|
@@ -143355,10 +143375,30 @@ var DomainRegistry = class {
|
|
|
143355
143375
|
}
|
|
143356
143376
|
const cmd = domain.commands.get(firstArg);
|
|
143357
143377
|
if (cmd) {
|
|
143378
|
+
const commandPath = `${domainName} ${firstArg}`;
|
|
143379
|
+
const validationError = this.validateCommandArgs(
|
|
143380
|
+
cmd,
|
|
143381
|
+
restArgs,
|
|
143382
|
+
domain.commands,
|
|
143383
|
+
commandPath
|
|
143384
|
+
);
|
|
143385
|
+
if (validationError) {
|
|
143386
|
+
return validationError;
|
|
143387
|
+
}
|
|
143358
143388
|
return cmd.execute(restArgs, session);
|
|
143359
143389
|
}
|
|
143360
143390
|
for (const [, command] of domain.commands) {
|
|
143361
143391
|
if (command.aliases?.includes(firstArg)) {
|
|
143392
|
+
const commandPath = `${domainName} ${command.name}`;
|
|
143393
|
+
const validationError = this.validateCommandArgs(
|
|
143394
|
+
command,
|
|
143395
|
+
restArgs,
|
|
143396
|
+
domain.commands,
|
|
143397
|
+
commandPath
|
|
143398
|
+
);
|
|
143399
|
+
if (validationError) {
|
|
143400
|
+
return validationError;
|
|
143401
|
+
}
|
|
143362
143402
|
return command.execute(restArgs, session);
|
|
143363
143403
|
}
|
|
143364
143404
|
}
|
|
@@ -143460,6 +143500,67 @@ var DomainRegistry = class {
|
|
|
143460
143500
|
contextChanged: false
|
|
143461
143501
|
};
|
|
143462
143502
|
}
|
|
143503
|
+
/**
|
|
143504
|
+
* Validate command arguments and check for conflicts with sibling commands.
|
|
143505
|
+
* Returns an error result if validation fails, undefined if OK to proceed.
|
|
143506
|
+
*/
|
|
143507
|
+
validateCommandArgs(cmd, cmdArgs, siblingCommands, commandPath) {
|
|
143508
|
+
if (cmdArgs.length === 0) {
|
|
143509
|
+
return void 0;
|
|
143510
|
+
}
|
|
143511
|
+
if (cmd.usage && cmd.usage.trim().length > 0) {
|
|
143512
|
+
return void 0;
|
|
143513
|
+
}
|
|
143514
|
+
const firstExtraArg = cmdArgs[0]?.toLowerCase() ?? "";
|
|
143515
|
+
const siblingCmd = siblingCommands.get(firstExtraArg);
|
|
143516
|
+
if (siblingCmd) {
|
|
143517
|
+
const pathParts = commandPath.split(" ");
|
|
143518
|
+
pathParts.pop();
|
|
143519
|
+
const suggestedPath = [...pathParts, ...cmdArgs].join(" ");
|
|
143520
|
+
return {
|
|
143521
|
+
output: [
|
|
143522
|
+
`Error: Cannot combine '${cmd.name}' with '${firstExtraArg}'.`,
|
|
143523
|
+
``,
|
|
143524
|
+
`Did you mean: ${suggestedPath}`
|
|
143525
|
+
],
|
|
143526
|
+
shouldExit: false,
|
|
143527
|
+
shouldClear: false,
|
|
143528
|
+
contextChanged: false,
|
|
143529
|
+
error: `Conflicting subcommands: '${cmd.name}' and '${firstExtraArg}'`
|
|
143530
|
+
};
|
|
143531
|
+
}
|
|
143532
|
+
for (const [siblingName, sibling] of siblingCommands) {
|
|
143533
|
+
if (sibling.aliases?.includes(firstExtraArg)) {
|
|
143534
|
+
const pathParts = commandPath.split(" ");
|
|
143535
|
+
pathParts.pop();
|
|
143536
|
+
const suggestedPath = [...pathParts, ...cmdArgs].join(" ");
|
|
143537
|
+
return {
|
|
143538
|
+
output: [
|
|
143539
|
+
`Error: Cannot combine '${cmd.name}' with '${firstExtraArg}' (alias for '${siblingName}').`,
|
|
143540
|
+
``,
|
|
143541
|
+
`Did you mean: ${suggestedPath}`
|
|
143542
|
+
],
|
|
143543
|
+
shouldExit: false,
|
|
143544
|
+
shouldClear: false,
|
|
143545
|
+
contextChanged: false,
|
|
143546
|
+
error: `Conflicting subcommands: '${cmd.name}' and '${firstExtraArg}'`
|
|
143547
|
+
};
|
|
143548
|
+
}
|
|
143549
|
+
}
|
|
143550
|
+
return {
|
|
143551
|
+
output: [
|
|
143552
|
+
`Error: Unexpected arguments for '${cmd.name}': ${cmdArgs.join(" ")}`,
|
|
143553
|
+
``,
|
|
143554
|
+
`Usage: ${commandPath}`,
|
|
143555
|
+
``,
|
|
143556
|
+
`The '${cmd.name}' command does not accept additional arguments.`
|
|
143557
|
+
],
|
|
143558
|
+
shouldExit: false,
|
|
143559
|
+
shouldClear: false,
|
|
143560
|
+
contextChanged: false,
|
|
143561
|
+
error: `Unexpected arguments: ${cmdArgs.join(" ")}`
|
|
143562
|
+
};
|
|
143563
|
+
}
|
|
143463
143564
|
};
|
|
143464
143565
|
var customDomains = new DomainRegistry();
|
|
143465
143566
|
function successResult(output, contextChanged = false) {
|