@robinmordasiewicz/f5xc-xcsh 1.0.82-2601010633 → 1.0.82-2601011720
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 +397 -76
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45392,8 +45392,8 @@ function getLogoModeFromEnv(envPrefix) {
|
|
|
45392
45392
|
var CLI_NAME = "xcsh";
|
|
45393
45393
|
var CLI_FULL_NAME = "F5 Distributed Cloud Shell";
|
|
45394
45394
|
function getVersion() {
|
|
45395
|
-
if ("v1.0.82-
|
|
45396
|
-
return "v1.0.82-
|
|
45395
|
+
if ("v1.0.82-2601011720") {
|
|
45396
|
+
return "v1.0.82-2601011720";
|
|
45397
45397
|
}
|
|
45398
45398
|
if (process.env.XCSH_VERSION) {
|
|
45399
45399
|
return process.env.XCSH_VERSION;
|
|
@@ -46157,6 +46157,35 @@ function getOutputFormatFromEnv() {
|
|
|
46157
46157
|
}
|
|
46158
46158
|
return void 0;
|
|
46159
46159
|
}
|
|
46160
|
+
function parseOutputFlag(args) {
|
|
46161
|
+
const remainingArgs = [];
|
|
46162
|
+
let format;
|
|
46163
|
+
for (let i = 0; i < args.length; i++) {
|
|
46164
|
+
const arg = args[i];
|
|
46165
|
+
if (arg === "-o" || arg === "--output") {
|
|
46166
|
+
const nextArg = args[i + 1];
|
|
46167
|
+
if (nextArg && !nextArg.startsWith("-")) {
|
|
46168
|
+
if (isValidOutputFormat(nextArg)) {
|
|
46169
|
+
format = nextArg.toLowerCase();
|
|
46170
|
+
}
|
|
46171
|
+
i++;
|
|
46172
|
+
}
|
|
46173
|
+
} else if (arg?.startsWith("--output=")) {
|
|
46174
|
+
const value = arg.slice("--output=".length);
|
|
46175
|
+
if (isValidOutputFormat(value)) {
|
|
46176
|
+
format = value.toLowerCase();
|
|
46177
|
+
}
|
|
46178
|
+
} else if (arg?.startsWith("-o=")) {
|
|
46179
|
+
const value = arg.slice("-o=".length);
|
|
46180
|
+
if (isValidOutputFormat(value)) {
|
|
46181
|
+
format = value.toLowerCase();
|
|
46182
|
+
}
|
|
46183
|
+
} else if (arg) {
|
|
46184
|
+
remainingArgs.push(arg);
|
|
46185
|
+
}
|
|
46186
|
+
}
|
|
46187
|
+
return { format, remainingArgs };
|
|
46188
|
+
}
|
|
46160
46189
|
function shouldUseColors(isTTY = process.stdout.isTTY ?? false, noColorFlag = false) {
|
|
46161
46190
|
if (noColorFlag) {
|
|
46162
46191
|
return false;
|
|
@@ -46442,6 +46471,45 @@ function extractItems(data) {
|
|
|
46442
46471
|
}
|
|
46443
46472
|
return [];
|
|
46444
46473
|
}
|
|
46474
|
+
function formatKeyValueBox(data, title, noColor = false) {
|
|
46475
|
+
if (data.length === 0) {
|
|
46476
|
+
return "";
|
|
46477
|
+
}
|
|
46478
|
+
const useColors = shouldUseColors(void 0, noColor);
|
|
46479
|
+
const box = useColors ? UNICODE_BOX : ASCII_BOX;
|
|
46480
|
+
const borderColor = colors.red;
|
|
46481
|
+
const colorBorder = (text) => applyColor(text, borderColor, useColors);
|
|
46482
|
+
const maxLabelWidth = Math.max(...data.map((d) => d.label.length));
|
|
46483
|
+
const contentLines = data.map((d) => {
|
|
46484
|
+
const paddedLabel = d.label.padEnd(maxLabelWidth);
|
|
46485
|
+
return `${paddedLabel}: ${d.value}`;
|
|
46486
|
+
});
|
|
46487
|
+
const titleText = ` ${title} `;
|
|
46488
|
+
const maxContentWidth = Math.max(
|
|
46489
|
+
...contentLines.map((l) => l.length),
|
|
46490
|
+
titleText.length
|
|
46491
|
+
);
|
|
46492
|
+
const innerWidth = maxContentWidth + 2;
|
|
46493
|
+
const lines = [];
|
|
46494
|
+
const remainingWidth = innerWidth - titleText.length;
|
|
46495
|
+
const leftDashes = 1;
|
|
46496
|
+
const rightDashes = Math.max(0, remainingWidth - leftDashes);
|
|
46497
|
+
lines.push(
|
|
46498
|
+
colorBorder(box.topLeft + box.horizontal.repeat(leftDashes)) + titleText + colorBorder(box.horizontal.repeat(rightDashes) + box.topRight)
|
|
46499
|
+
);
|
|
46500
|
+
for (const text of contentLines) {
|
|
46501
|
+
const padding = innerWidth - text.length;
|
|
46502
|
+
lines.push(
|
|
46503
|
+
colorBorder(box.vertical) + ` ${text}${" ".repeat(Math.max(0, padding - 1))}` + colorBorder(box.vertical)
|
|
46504
|
+
);
|
|
46505
|
+
}
|
|
46506
|
+
lines.push(
|
|
46507
|
+
colorBorder(
|
|
46508
|
+
box.bottomLeft + box.horizontal.repeat(innerWidth) + box.bottomRight
|
|
46509
|
+
)
|
|
46510
|
+
);
|
|
46511
|
+
return lines.join("\n");
|
|
46512
|
+
}
|
|
46445
46513
|
|
|
46446
46514
|
// src/output/formatter.ts
|
|
46447
46515
|
function formatOutput(data, format = "table", noColor = false) {
|
|
@@ -48773,6 +48841,120 @@ function useHistory(options) {
|
|
|
48773
48841
|
// src/repl/hooks/useCompletion.ts
|
|
48774
48842
|
var import_react27 = __toESM(require_react(), 1);
|
|
48775
48843
|
|
|
48844
|
+
// src/output/domain-formatter.ts
|
|
48845
|
+
function parseDomainOutputFlags(args, sessionFormat = "table") {
|
|
48846
|
+
const { format: parsedFormat, remainingArgs } = parseOutputFlag(args);
|
|
48847
|
+
let noColor = false;
|
|
48848
|
+
const finalArgs = [];
|
|
48849
|
+
for (const arg of remainingArgs) {
|
|
48850
|
+
if (arg === "--no-color") {
|
|
48851
|
+
noColor = true;
|
|
48852
|
+
} else {
|
|
48853
|
+
finalArgs.push(arg);
|
|
48854
|
+
}
|
|
48855
|
+
}
|
|
48856
|
+
const effectiveNoColor = noColor || !shouldUseColors();
|
|
48857
|
+
return {
|
|
48858
|
+
options: {
|
|
48859
|
+
format: parsedFormat ?? sessionFormat,
|
|
48860
|
+
noColor: effectiveNoColor
|
|
48861
|
+
},
|
|
48862
|
+
remainingArgs: finalArgs
|
|
48863
|
+
};
|
|
48864
|
+
}
|
|
48865
|
+
function formatDomainOutput(data, options) {
|
|
48866
|
+
const { format, noColor } = options;
|
|
48867
|
+
if (format === "none") {
|
|
48868
|
+
return [];
|
|
48869
|
+
}
|
|
48870
|
+
const formatted = formatOutput(data, format, noColor);
|
|
48871
|
+
if (formatted === "") {
|
|
48872
|
+
return [];
|
|
48873
|
+
}
|
|
48874
|
+
return formatted.split("\n");
|
|
48875
|
+
}
|
|
48876
|
+
function formatKeyValueOutput(data, options) {
|
|
48877
|
+
const { format, noColor, title } = options;
|
|
48878
|
+
if (format === "none") {
|
|
48879
|
+
return [];
|
|
48880
|
+
}
|
|
48881
|
+
if (format === "json") {
|
|
48882
|
+
return formatJSON(data).split("\n");
|
|
48883
|
+
}
|
|
48884
|
+
if (format === "yaml") {
|
|
48885
|
+
return formatYAML(data).split("\n");
|
|
48886
|
+
}
|
|
48887
|
+
if (format === "tsv") {
|
|
48888
|
+
const lines = [];
|
|
48889
|
+
for (const [key, value] of Object.entries(data)) {
|
|
48890
|
+
if (value !== null && value !== void 0) {
|
|
48891
|
+
lines.push(`${key} ${String(value)}`);
|
|
48892
|
+
}
|
|
48893
|
+
}
|
|
48894
|
+
return lines;
|
|
48895
|
+
}
|
|
48896
|
+
const boxData = [];
|
|
48897
|
+
for (const [key, value] of Object.entries(data)) {
|
|
48898
|
+
if (value !== null && value !== void 0) {
|
|
48899
|
+
const label = formatLabel(key);
|
|
48900
|
+
boxData.push({ label, value: String(value) });
|
|
48901
|
+
}
|
|
48902
|
+
}
|
|
48903
|
+
if (boxData.length === 0) {
|
|
48904
|
+
return [];
|
|
48905
|
+
}
|
|
48906
|
+
const boxOutput = formatKeyValueBox(boxData, title ?? "Info", noColor);
|
|
48907
|
+
return boxOutput.split("\n");
|
|
48908
|
+
}
|
|
48909
|
+
function formatListOutput(data, options) {
|
|
48910
|
+
const { format, noColor } = options;
|
|
48911
|
+
if (format === "none") {
|
|
48912
|
+
return [];
|
|
48913
|
+
}
|
|
48914
|
+
if (format === "json") {
|
|
48915
|
+
return formatJSON(data).split("\n");
|
|
48916
|
+
}
|
|
48917
|
+
if (format === "yaml") {
|
|
48918
|
+
return formatYAML(data).split("\n");
|
|
48919
|
+
}
|
|
48920
|
+
if (format === "tsv") {
|
|
48921
|
+
if (data.length === 0) {
|
|
48922
|
+
return [];
|
|
48923
|
+
}
|
|
48924
|
+
const firstItem = data[0];
|
|
48925
|
+
if (typeof firstItem !== "object" || firstItem === null) {
|
|
48926
|
+
return data.map((item) => String(item));
|
|
48927
|
+
}
|
|
48928
|
+
const keys = Object.keys(firstItem);
|
|
48929
|
+
const lines = [];
|
|
48930
|
+
for (const item of data) {
|
|
48931
|
+
if (typeof item === "object" && item !== null) {
|
|
48932
|
+
const record = item;
|
|
48933
|
+
const values = keys.map((k) => {
|
|
48934
|
+
const val = record[k];
|
|
48935
|
+
if (val === null || val === void 0) return "";
|
|
48936
|
+
if (typeof val === "object") return JSON.stringify(val);
|
|
48937
|
+
return String(val);
|
|
48938
|
+
});
|
|
48939
|
+
lines.push(values.join(" "));
|
|
48940
|
+
}
|
|
48941
|
+
}
|
|
48942
|
+
return lines;
|
|
48943
|
+
}
|
|
48944
|
+
const tableOutput = formatResourceTable(data, noColor);
|
|
48945
|
+
if (tableOutput === "") {
|
|
48946
|
+
return [];
|
|
48947
|
+
}
|
|
48948
|
+
return tableOutput.split("\n");
|
|
48949
|
+
}
|
|
48950
|
+
function formatLabel(key) {
|
|
48951
|
+
if (key.includes("_")) {
|
|
48952
|
+
return key.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
48953
|
+
}
|
|
48954
|
+
const withSpaces = key.replace(/([A-Z])/g, " $1");
|
|
48955
|
+
return withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1);
|
|
48956
|
+
}
|
|
48957
|
+
|
|
48776
48958
|
// src/domains/login/profile/list.ts
|
|
48777
48959
|
var listCommand = {
|
|
48778
48960
|
name: "list",
|
|
@@ -48780,25 +48962,46 @@ var listCommand = {
|
|
|
48780
48962
|
descriptionShort: "List all saved profiles",
|
|
48781
48963
|
descriptionMedium: "Show all profiles with tenant URLs, auth types, and active status indicator.",
|
|
48782
48964
|
aliases: ["ls"],
|
|
48783
|
-
async execute(
|
|
48965
|
+
async execute(args, session) {
|
|
48966
|
+
const { options } = parseDomainOutputFlags(
|
|
48967
|
+
args,
|
|
48968
|
+
session.getOutputFormat()
|
|
48969
|
+
);
|
|
48784
48970
|
const manager = getProfileManager();
|
|
48785
48971
|
try {
|
|
48786
48972
|
const profiles = await manager.list();
|
|
48787
48973
|
const activeProfile = await manager.getActive();
|
|
48788
48974
|
if (profiles.length === 0) {
|
|
48975
|
+
if (options.format === "none") {
|
|
48976
|
+
return successResult([]);
|
|
48977
|
+
}
|
|
48789
48978
|
return successResult([
|
|
48790
48979
|
"No profiles configured.",
|
|
48791
48980
|
"",
|
|
48792
48981
|
"Create a profile with: login profile create <name>"
|
|
48793
48982
|
]);
|
|
48794
48983
|
}
|
|
48795
|
-
const
|
|
48796
|
-
for (const profile of profiles) {
|
|
48984
|
+
const data = profiles.map((profile) => {
|
|
48797
48985
|
const isActive = profile.name === activeProfile;
|
|
48798
|
-
const marker = isActive ? " [active]" : "";
|
|
48799
48986
|
const authType = profile.apiToken ? "token" : profile.cert ? "cert" : profile.p12Bundle ? "p12" : "none";
|
|
48987
|
+
return {
|
|
48988
|
+
name: profile.name,
|
|
48989
|
+
apiUrl: profile.apiUrl,
|
|
48990
|
+
authType,
|
|
48991
|
+
active: isActive
|
|
48992
|
+
};
|
|
48993
|
+
});
|
|
48994
|
+
if (options.format === "none") {
|
|
48995
|
+
return successResult([]);
|
|
48996
|
+
}
|
|
48997
|
+
if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
|
|
48998
|
+
return successResult(formatListOutput(data, options));
|
|
48999
|
+
}
|
|
49000
|
+
const output = ["Saved profiles:"];
|
|
49001
|
+
for (const item of data) {
|
|
49002
|
+
const marker = item.active ? " [active]" : "";
|
|
48800
49003
|
output.push(
|
|
48801
|
-
` ${
|
|
49004
|
+
` ${item.name}${marker} - ${item.apiUrl} (${item.authType})`
|
|
48802
49005
|
);
|
|
48803
49006
|
}
|
|
48804
49007
|
return successResult(output);
|
|
@@ -48818,9 +49021,13 @@ var showCommand = {
|
|
|
48818
49021
|
descriptionMedium: "Display profile configuration with tenant URL, auth type, and masked credentials.",
|
|
48819
49022
|
usage: "<name>",
|
|
48820
49023
|
aliases: ["get", "view"],
|
|
48821
|
-
async execute(args,
|
|
49024
|
+
async execute(args, session) {
|
|
49025
|
+
const { options, remainingArgs } = parseDomainOutputFlags(
|
|
49026
|
+
args,
|
|
49027
|
+
session.getOutputFormat()
|
|
49028
|
+
);
|
|
48822
49029
|
const manager = getProfileManager();
|
|
48823
|
-
const name =
|
|
49030
|
+
const name = remainingArgs[0];
|
|
48824
49031
|
if (!name) {
|
|
48825
49032
|
return errorResult("Usage: login profile show <name>");
|
|
48826
49033
|
}
|
|
@@ -48832,6 +49039,28 @@ var showCommand = {
|
|
|
48832
49039
|
const masked = manager.maskProfile(profile);
|
|
48833
49040
|
const activeProfile = await manager.getActive();
|
|
48834
49041
|
const isActive = profile.name === activeProfile;
|
|
49042
|
+
if (options.format === "none") {
|
|
49043
|
+
return successResult([]);
|
|
49044
|
+
}
|
|
49045
|
+
const data = {
|
|
49046
|
+
name: profile.name,
|
|
49047
|
+
apiUrl: masked.apiUrl,
|
|
49048
|
+
active: isActive
|
|
49049
|
+
};
|
|
49050
|
+
if (masked.apiToken) data.apiToken = masked.apiToken;
|
|
49051
|
+
if (masked.p12Bundle) data.p12Bundle = masked.p12Bundle;
|
|
49052
|
+
if (masked.cert) data.cert = masked.cert;
|
|
49053
|
+
if (masked.key) data.key = masked.key;
|
|
49054
|
+
if (masked.defaultNamespace)
|
|
49055
|
+
data.namespace = masked.defaultNamespace;
|
|
49056
|
+
if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
|
|
49057
|
+
return successResult(
|
|
49058
|
+
formatKeyValueOutput(data, {
|
|
49059
|
+
...options,
|
|
49060
|
+
title: "Profile"
|
|
49061
|
+
})
|
|
49062
|
+
);
|
|
49063
|
+
}
|
|
48835
49064
|
const output = [
|
|
48836
49065
|
`Profile: ${profile.name}${isActive ? " [active]" : ""}`,
|
|
48837
49066
|
``,
|
|
@@ -49193,11 +49422,18 @@ var activeCommand = {
|
|
|
49193
49422
|
description: "Display the currently active profile configuration including tenant URL, authentication method, and default namespace. Shows masked credentials for security while confirming connection settings.",
|
|
49194
49423
|
descriptionShort: "Display active profile configuration",
|
|
49195
49424
|
descriptionMedium: "Show current active profile details including tenant URL, auth type, and namespace settings.",
|
|
49196
|
-
async execute(
|
|
49425
|
+
async execute(args, session) {
|
|
49426
|
+
const { options } = parseDomainOutputFlags(
|
|
49427
|
+
args,
|
|
49428
|
+
session.getOutputFormat()
|
|
49429
|
+
);
|
|
49197
49430
|
const manager = getProfileManager();
|
|
49198
49431
|
try {
|
|
49199
49432
|
const activeName = await manager.getActive();
|
|
49200
49433
|
if (!activeName) {
|
|
49434
|
+
if (options.format === "none") {
|
|
49435
|
+
return successResult([]);
|
|
49436
|
+
}
|
|
49201
49437
|
return successResult([
|
|
49202
49438
|
"No active profile set.",
|
|
49203
49439
|
"",
|
|
@@ -49212,6 +49448,27 @@ var activeCommand = {
|
|
|
49212
49448
|
);
|
|
49213
49449
|
}
|
|
49214
49450
|
const masked = manager.maskProfile(profile);
|
|
49451
|
+
if (options.format === "none") {
|
|
49452
|
+
return successResult([]);
|
|
49453
|
+
}
|
|
49454
|
+
const data = {
|
|
49455
|
+
name: profile.name,
|
|
49456
|
+
apiUrl: masked.apiUrl
|
|
49457
|
+
};
|
|
49458
|
+
if (masked.apiToken) data.apiToken = masked.apiToken;
|
|
49459
|
+
if (masked.p12Bundle) data.p12Bundle = masked.p12Bundle;
|
|
49460
|
+
if (masked.cert) data.cert = masked.cert;
|
|
49461
|
+
if (masked.key) data.key = masked.key;
|
|
49462
|
+
if (masked.defaultNamespace)
|
|
49463
|
+
data.namespace = masked.defaultNamespace;
|
|
49464
|
+
if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
|
|
49465
|
+
return successResult(
|
|
49466
|
+
formatKeyValueOutput(data, {
|
|
49467
|
+
...options,
|
|
49468
|
+
title: "Active Profile"
|
|
49469
|
+
})
|
|
49470
|
+
);
|
|
49471
|
+
}
|
|
49215
49472
|
const output = [
|
|
49216
49473
|
`Active Profile: ${profile.name}`,
|
|
49217
49474
|
``,
|
|
@@ -49249,9 +49506,28 @@ var showCommand2 = {
|
|
|
49249
49506
|
descriptionMedium: "Display active namespace context and its configuration source.",
|
|
49250
49507
|
usage: "",
|
|
49251
49508
|
aliases: ["current", "get"],
|
|
49252
|
-
async execute(
|
|
49509
|
+
async execute(args, session) {
|
|
49510
|
+
const { options } = parseDomainOutputFlags(
|
|
49511
|
+
args,
|
|
49512
|
+
session.getOutputFormat()
|
|
49513
|
+
);
|
|
49253
49514
|
const namespace = session.getNamespace();
|
|
49254
49515
|
const source = determineNamespaceSource(namespace);
|
|
49516
|
+
if (options.format === "none") {
|
|
49517
|
+
return successResult([]);
|
|
49518
|
+
}
|
|
49519
|
+
const data = {
|
|
49520
|
+
namespace,
|
|
49521
|
+
source
|
|
49522
|
+
};
|
|
49523
|
+
if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
|
|
49524
|
+
return successResult(
|
|
49525
|
+
formatKeyValueOutput(data, {
|
|
49526
|
+
...options,
|
|
49527
|
+
title: "Context"
|
|
49528
|
+
})
|
|
49529
|
+
);
|
|
49530
|
+
}
|
|
49255
49531
|
const lines = [
|
|
49256
49532
|
`Current namespace: ${namespace}`,
|
|
49257
49533
|
`Source: ${source}`
|
|
@@ -49329,7 +49605,11 @@ var listCommand2 = {
|
|
|
49329
49605
|
descriptionMedium: "Query tenant for available namespaces with current context indicator.",
|
|
49330
49606
|
usage: "",
|
|
49331
49607
|
aliases: ["ls"],
|
|
49332
|
-
async execute(
|
|
49608
|
+
async execute(args, session) {
|
|
49609
|
+
const { options } = parseDomainOutputFlags(
|
|
49610
|
+
args,
|
|
49611
|
+
session.getOutputFormat()
|
|
49612
|
+
);
|
|
49333
49613
|
const currentNamespace = session.getNamespace();
|
|
49334
49614
|
if (!session.isConnected()) {
|
|
49335
49615
|
return errorResult(
|
|
@@ -49349,6 +49629,16 @@ var listCommand2 = {
|
|
|
49349
49629
|
}
|
|
49350
49630
|
const namespaces = response.data.items.map((item) => item.name).filter((name) => !!name).sort();
|
|
49351
49631
|
session.setNamespaceCache(namespaces);
|
|
49632
|
+
if (options.format === "none") {
|
|
49633
|
+
return successResult([]);
|
|
49634
|
+
}
|
|
49635
|
+
const data = namespaces.map((ns) => ({
|
|
49636
|
+
name: ns,
|
|
49637
|
+
current: ns === currentNamespace
|
|
49638
|
+
}));
|
|
49639
|
+
if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
|
|
49640
|
+
return successResult(formatListOutput(data, options));
|
|
49641
|
+
}
|
|
49352
49642
|
const lines = ["Available namespaces:", ""];
|
|
49353
49643
|
for (const ns of namespaces) {
|
|
49354
49644
|
if (ns === currentNamespace) {
|
|
@@ -49920,14 +50210,43 @@ function formatWhoamiBox(info) {
|
|
|
49920
50210
|
}
|
|
49921
50211
|
|
|
49922
50212
|
// src/domains/login/whoami/index.ts
|
|
50213
|
+
function whoamiToKeyValue(info) {
|
|
50214
|
+
const data = {};
|
|
50215
|
+
if (info.tenant) data.tenant = info.tenant;
|
|
50216
|
+
if (info.email) {
|
|
50217
|
+
data.user = info.email;
|
|
50218
|
+
} else if (info.username) {
|
|
50219
|
+
data.user = info.username;
|
|
50220
|
+
}
|
|
50221
|
+
data.namespace = info.namespace;
|
|
50222
|
+
data.serverUrl = info.serverUrl;
|
|
50223
|
+
data.isAuthenticated = info.isAuthenticated;
|
|
50224
|
+
return data;
|
|
50225
|
+
}
|
|
49923
50226
|
var whoamiCommand = {
|
|
49924
50227
|
name: "show",
|
|
49925
50228
|
description: "Display current connection status and authenticated identity information. Shows active profile, tenant URL, username, tenant details, and session context including namespace targeting.",
|
|
49926
50229
|
descriptionShort: "Show connection and identity info",
|
|
49927
50230
|
descriptionMedium: "Display active profile, tenant URL, user identity, and current namespace context.",
|
|
49928
|
-
async execute(
|
|
50231
|
+
async execute(args, session) {
|
|
50232
|
+
const { options } = parseDomainOutputFlags(
|
|
50233
|
+
args,
|
|
50234
|
+
session.getOutputFormat()
|
|
50235
|
+
);
|
|
49929
50236
|
try {
|
|
49930
50237
|
const info = await getWhoamiInfo(session);
|
|
50238
|
+
if (options.format === "none") {
|
|
50239
|
+
return successResult([]);
|
|
50240
|
+
}
|
|
50241
|
+
if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
|
|
50242
|
+
const keyValueData = whoamiToKeyValue(info);
|
|
50243
|
+
return successResult(
|
|
50244
|
+
formatKeyValueOutput(keyValueData, {
|
|
50245
|
+
...options,
|
|
50246
|
+
title: "Connection Info"
|
|
50247
|
+
})
|
|
50248
|
+
);
|
|
50249
|
+
}
|
|
49931
50250
|
const output = formatWhoami(info);
|
|
49932
50251
|
return successResult(output);
|
|
49933
50252
|
} catch (error) {
|
|
@@ -50303,29 +50622,22 @@ function calculateRegionalStatus(components) {
|
|
|
50303
50622
|
|
|
50304
50623
|
// src/domains/cloudstatus/index.ts
|
|
50305
50624
|
function parseOutputArgs(args, session) {
|
|
50306
|
-
|
|
50625
|
+
const { options, remainingArgs } = parseDomainOutputFlags(
|
|
50626
|
+
args,
|
|
50627
|
+
session.getOutputFormat()
|
|
50628
|
+
);
|
|
50307
50629
|
let spec = false;
|
|
50308
50630
|
const filteredArgs = [];
|
|
50309
|
-
for (
|
|
50310
|
-
|
|
50311
|
-
const nextArg = args[i + 1];
|
|
50312
|
-
if (arg === "--output" || arg === "-o") {
|
|
50313
|
-
if (nextArg) {
|
|
50314
|
-
format = parseOutputFormat(nextArg);
|
|
50315
|
-
i++;
|
|
50316
|
-
}
|
|
50317
|
-
} else if (arg === "--spec") {
|
|
50631
|
+
for (const arg of remainingArgs) {
|
|
50632
|
+
if (arg === "--spec") {
|
|
50318
50633
|
spec = true;
|
|
50319
|
-
} else if (arg.startsWith("--output=")) {
|
|
50320
|
-
format = parseOutputFormat(arg.split("=")[1] ?? "table");
|
|
50321
|
-
} else if (arg.startsWith("-o=")) {
|
|
50322
|
-
format = parseOutputFormat(arg.split("=")[1] ?? "table");
|
|
50323
50634
|
} else {
|
|
50324
50635
|
filteredArgs.push(arg);
|
|
50325
50636
|
}
|
|
50326
50637
|
}
|
|
50327
50638
|
return {
|
|
50328
|
-
format: format
|
|
50639
|
+
format: options.format,
|
|
50640
|
+
noColor: options.noColor,
|
|
50329
50641
|
spec,
|
|
50330
50642
|
filteredArgs
|
|
50331
50643
|
};
|
|
@@ -50345,7 +50657,10 @@ var statusCommand = {
|
|
|
50345
50657
|
usage: "[--quiet]",
|
|
50346
50658
|
aliases: ["st"],
|
|
50347
50659
|
async execute(args, session) {
|
|
50348
|
-
const { format, spec, filteredArgs } = parseOutputArgs(
|
|
50660
|
+
const { format, noColor, spec, filteredArgs } = parseOutputArgs(
|
|
50661
|
+
args,
|
|
50662
|
+
session
|
|
50663
|
+
);
|
|
50349
50664
|
const quiet = filteredArgs.includes("--quiet") || filteredArgs.includes("-q");
|
|
50350
50665
|
if (spec) {
|
|
50351
50666
|
const cmdSpec = getCommandSpec("cloudstatus status");
|
|
@@ -50364,21 +50679,13 @@ var statusCommand = {
|
|
|
50364
50679
|
`Exit code: ${exitCode} (${response.status.indicator})`
|
|
50365
50680
|
]);
|
|
50366
50681
|
}
|
|
50367
|
-
if (format === "
|
|
50368
|
-
return successResult([
|
|
50369
|
-
}
|
|
50370
|
-
if (format === "yaml") {
|
|
50371
|
-
|
|
50372
|
-
|
|
50373
|
-
|
|
50374
|
-
` name: ${response.page.name}`,
|
|
50375
|
-
` url: ${response.page.url}`,
|
|
50376
|
-
` updated_at: ${response.page.updated_at}`,
|
|
50377
|
-
"status:",
|
|
50378
|
-
` indicator: ${response.status.indicator}`,
|
|
50379
|
-
` description: ${response.status.description}`
|
|
50380
|
-
].join("\n");
|
|
50381
|
-
return successResult([yaml]);
|
|
50682
|
+
if (format === "none") {
|
|
50683
|
+
return successResult([]);
|
|
50684
|
+
}
|
|
50685
|
+
if (format === "json" || format === "yaml" || format === "tsv") {
|
|
50686
|
+
return successResult(
|
|
50687
|
+
formatDomainOutput(response, { format, noColor })
|
|
50688
|
+
);
|
|
50382
50689
|
}
|
|
50383
50690
|
const lines = [
|
|
50384
50691
|
"\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510",
|
|
@@ -50402,7 +50709,10 @@ var summaryCommand = {
|
|
|
50402
50709
|
usage: "[--brief]",
|
|
50403
50710
|
aliases: ["sum"],
|
|
50404
50711
|
async execute(args, session) {
|
|
50405
|
-
const { format, spec, filteredArgs } = parseOutputArgs(
|
|
50712
|
+
const { format, noColor, spec, filteredArgs } = parseOutputArgs(
|
|
50713
|
+
args,
|
|
50714
|
+
session
|
|
50715
|
+
);
|
|
50406
50716
|
const brief = filteredArgs.includes("--brief") || filteredArgs.includes("-b");
|
|
50407
50717
|
if (spec) {
|
|
50408
50718
|
const cmdSpec = getCommandSpec("cloudstatus summary");
|
|
@@ -50413,11 +50723,13 @@ var summaryCommand = {
|
|
|
50413
50723
|
try {
|
|
50414
50724
|
const client = getClient();
|
|
50415
50725
|
const response = await client.getSummary();
|
|
50416
|
-
if (format === "
|
|
50417
|
-
return successResult([
|
|
50726
|
+
if (format === "none") {
|
|
50727
|
+
return successResult([]);
|
|
50418
50728
|
}
|
|
50419
|
-
if (format === "yaml") {
|
|
50420
|
-
return successResult(
|
|
50729
|
+
if (format === "json" || format === "yaml" || format === "tsv") {
|
|
50730
|
+
return successResult(
|
|
50731
|
+
formatDomainOutput(response, { format, noColor })
|
|
50732
|
+
);
|
|
50421
50733
|
}
|
|
50422
50734
|
if (brief) {
|
|
50423
50735
|
return successResult(formatBriefSummary(response));
|
|
@@ -50437,7 +50749,10 @@ var componentsCommand = {
|
|
|
50437
50749
|
usage: "[--degraded-only]",
|
|
50438
50750
|
aliases: ["comp"],
|
|
50439
50751
|
async execute(args, session) {
|
|
50440
|
-
const { format, spec, filteredArgs } = parseOutputArgs(
|
|
50752
|
+
const { format, noColor, spec, filteredArgs } = parseOutputArgs(
|
|
50753
|
+
args,
|
|
50754
|
+
session
|
|
50755
|
+
);
|
|
50441
50756
|
const degradedOnly = filteredArgs.includes("--degraded-only") || filteredArgs.includes("-d");
|
|
50442
50757
|
if (spec) {
|
|
50443
50758
|
const cmdSpec = getCommandSpec("cloudstatus components");
|
|
@@ -50452,8 +50767,13 @@ var componentsCommand = {
|
|
|
50452
50767
|
if (degradedOnly) {
|
|
50453
50768
|
components = components.filter((c) => isComponentDegraded(c));
|
|
50454
50769
|
}
|
|
50455
|
-
if (format === "
|
|
50456
|
-
return successResult([
|
|
50770
|
+
if (format === "none") {
|
|
50771
|
+
return successResult([]);
|
|
50772
|
+
}
|
|
50773
|
+
if (format === "json" || format === "yaml" || format === "tsv") {
|
|
50774
|
+
return successResult(
|
|
50775
|
+
formatListOutput(components, { format, noColor })
|
|
50776
|
+
);
|
|
50457
50777
|
}
|
|
50458
50778
|
if (components.length === 0) {
|
|
50459
50779
|
return successResult(["No components found."]);
|
|
@@ -50486,7 +50806,10 @@ var incidentsCommand = {
|
|
|
50486
50806
|
usage: "[--active-only]",
|
|
50487
50807
|
aliases: ["inc"],
|
|
50488
50808
|
async execute(args, session) {
|
|
50489
|
-
const { format, spec, filteredArgs } = parseOutputArgs(
|
|
50809
|
+
const { format, noColor, spec, filteredArgs } = parseOutputArgs(
|
|
50810
|
+
args,
|
|
50811
|
+
session
|
|
50812
|
+
);
|
|
50490
50813
|
const activeOnly = filteredArgs.includes("--active-only") || filteredArgs.includes("-a");
|
|
50491
50814
|
if (spec) {
|
|
50492
50815
|
const cmdSpec = getCommandSpec("cloudstatus incidents");
|
|
@@ -50497,10 +50820,13 @@ var incidentsCommand = {
|
|
|
50497
50820
|
try {
|
|
50498
50821
|
const client = getClient();
|
|
50499
50822
|
const response = activeOnly ? await client.getUnresolvedIncidents() : await client.getIncidents();
|
|
50500
|
-
if (format === "
|
|
50501
|
-
return successResult([
|
|
50502
|
-
|
|
50503
|
-
|
|
50823
|
+
if (format === "none") {
|
|
50824
|
+
return successResult([]);
|
|
50825
|
+
}
|
|
50826
|
+
if (format === "json" || format === "yaml" || format === "tsv") {
|
|
50827
|
+
return successResult(
|
|
50828
|
+
formatListOutput(response.incidents, { format, noColor })
|
|
50829
|
+
);
|
|
50504
50830
|
}
|
|
50505
50831
|
if (response.incidents.length === 0) {
|
|
50506
50832
|
return successResult(["No incidents found."]);
|
|
@@ -50533,7 +50859,10 @@ var maintenanceCommand = {
|
|
|
50533
50859
|
usage: "[--upcoming]",
|
|
50534
50860
|
aliases: ["maint"],
|
|
50535
50861
|
async execute(args, session) {
|
|
50536
|
-
const { format, spec, filteredArgs } = parseOutputArgs(
|
|
50862
|
+
const { format, noColor, spec, filteredArgs } = parseOutputArgs(
|
|
50863
|
+
args,
|
|
50864
|
+
session
|
|
50865
|
+
);
|
|
50537
50866
|
const upcomingOnly = filteredArgs.includes("--upcoming") || filteredArgs.includes("-u");
|
|
50538
50867
|
if (spec) {
|
|
50539
50868
|
const cmdSpec = getCommandSpec("cloudstatus maintenance");
|
|
@@ -50544,10 +50873,16 @@ var maintenanceCommand = {
|
|
|
50544
50873
|
try {
|
|
50545
50874
|
const client = getClient();
|
|
50546
50875
|
const response = upcomingOnly ? await client.getUpcomingMaintenances() : await client.getMaintenances();
|
|
50547
|
-
if (format === "
|
|
50548
|
-
return successResult([
|
|
50549
|
-
|
|
50550
|
-
|
|
50876
|
+
if (format === "none") {
|
|
50877
|
+
return successResult([]);
|
|
50878
|
+
}
|
|
50879
|
+
if (format === "json" || format === "yaml" || format === "tsv") {
|
|
50880
|
+
return successResult(
|
|
50881
|
+
formatListOutput(response.scheduled_maintenances, {
|
|
50882
|
+
format,
|
|
50883
|
+
noColor
|
|
50884
|
+
})
|
|
50885
|
+
);
|
|
50551
50886
|
}
|
|
50552
50887
|
if (response.scheduled_maintenances.length === 0) {
|
|
50553
50888
|
return successResult(["No scheduled maintenance."]);
|
|
@@ -50678,20 +51013,6 @@ function formatFullSummary(summary) {
|
|
|
50678
51013
|
}
|
|
50679
51014
|
return lines;
|
|
50680
51015
|
}
|
|
50681
|
-
function formatSummaryYaml(summary) {
|
|
50682
|
-
const lines = [];
|
|
50683
|
-
lines.push("status:");
|
|
50684
|
-
lines.push(` indicator: ${summary.status.indicator}`);
|
|
50685
|
-
lines.push(` description: ${summary.status.description}`);
|
|
50686
|
-
lines.push("page:");
|
|
50687
|
-
lines.push(` id: ${summary.page.id}`);
|
|
50688
|
-
lines.push(` name: ${summary.page.name}`);
|
|
50689
|
-
lines.push(` updated_at: ${summary.page.updated_at}`);
|
|
50690
|
-
lines.push(`components_count: ${summary.components.length}`);
|
|
50691
|
-
lines.push(`incidents_count: ${summary.incidents.length}`);
|
|
50692
|
-
lines.push(`maintenances_count: ${summary.scheduled_maintenances.length}`);
|
|
50693
|
-
return lines.join("\n");
|
|
50694
|
-
}
|
|
50695
51016
|
var cloudstatusDomain = {
|
|
50696
51017
|
name: "cloudstatus",
|
|
50697
51018
|
description: "Monitor F5 Distributed Cloud service status and incidents. Check overall status indicators, view component health, track active incidents and their updates, and monitor scheduled maintenance windows.",
|