@robinmordasiewicz/f5xc-xcsh 1.0.91-2601040611 → 1.0.91-2601040646
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 +33 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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-2601040646") {
|
|
47056
|
+
return "v1.0.91-2601040646";
|
|
47057
47057
|
}
|
|
47058
47058
|
if (process.env.XCSH_VERSION) {
|
|
47059
47059
|
return process.env.XCSH_VERSION;
|
|
@@ -48157,7 +48157,7 @@ function extractItems(data) {
|
|
|
48157
48157
|
}
|
|
48158
48158
|
return [];
|
|
48159
48159
|
}
|
|
48160
|
-
function formatKeyValueBox(data, title, noColor = false) {
|
|
48160
|
+
function formatKeyValueBox(data, title, noColor = false, maxWidth) {
|
|
48161
48161
|
if (data.length === 0) {
|
|
48162
48162
|
return "";
|
|
48163
48163
|
}
|
|
@@ -48166,14 +48166,27 @@ function formatKeyValueBox(data, title, noColor = false) {
|
|
|
48166
48166
|
const borderColor = colors.red;
|
|
48167
48167
|
const colorBorder = (text) => applyColor(text, borderColor, useColors);
|
|
48168
48168
|
const maxLabelWidth = Math.max(...data.map((d) => d.label.length));
|
|
48169
|
-
const
|
|
48169
|
+
const effectiveMaxWidth = maxWidth ?? getTerminalWidth();
|
|
48170
|
+
const boxOverhead = 7;
|
|
48171
|
+
const maxValueWidth = Math.max(
|
|
48172
|
+
20,
|
|
48173
|
+
effectiveMaxWidth - maxLabelWidth - boxOverhead
|
|
48174
|
+
);
|
|
48175
|
+
const contentLines = [];
|
|
48176
|
+
for (const d of data) {
|
|
48170
48177
|
const paddedLabel = d.label.padEnd(maxLabelWidth);
|
|
48171
|
-
|
|
48172
|
-
});
|
|
48178
|
+
const wrappedValueLines = wrapText2(d.value, maxValueWidth);
|
|
48179
|
+
contentLines.push(`${paddedLabel}: ${wrappedValueLines[0] ?? ""}`);
|
|
48180
|
+
const indent = " ".repeat(maxLabelWidth + 3);
|
|
48181
|
+
for (let i = 1; i < wrappedValueLines.length; i++) {
|
|
48182
|
+
contentLines.push(`${indent}${wrappedValueLines[i]}`);
|
|
48183
|
+
}
|
|
48184
|
+
}
|
|
48173
48185
|
const titleText = ` ${title} `;
|
|
48174
|
-
const maxContentWidth = Math.
|
|
48175
|
-
...contentLines.map((l) => l.length),
|
|
48176
|
-
|
|
48186
|
+
const maxContentWidth = Math.min(
|
|
48187
|
+
Math.max(...contentLines.map((l) => l.length), titleText.length),
|
|
48188
|
+
effectiveMaxWidth - 4
|
|
48189
|
+
// 4 = borders + padding on each side
|
|
48177
48190
|
);
|
|
48178
48191
|
const innerWidth = maxContentWidth + 2;
|
|
48179
48192
|
const lines = [];
|
|
@@ -48184,9 +48197,10 @@ function formatKeyValueBox(data, title, noColor = false) {
|
|
|
48184
48197
|
colorBorder(box.topLeft + box.horizontal.repeat(leftDashes)) + titleText + colorBorder(box.horizontal.repeat(rightDashes) + box.topRight)
|
|
48185
48198
|
);
|
|
48186
48199
|
for (const text of contentLines) {
|
|
48187
|
-
const
|
|
48200
|
+
const displayText = text.slice(0, innerWidth - 2);
|
|
48201
|
+
const padding = innerWidth - displayText.length;
|
|
48188
48202
|
lines.push(
|
|
48189
|
-
colorBorder(box.vertical) + ` ${
|
|
48203
|
+
colorBorder(box.vertical) + ` ${displayText}${" ".repeat(Math.max(0, padding - 1))}` + colorBorder(box.vertical)
|
|
48190
48204
|
);
|
|
48191
48205
|
}
|
|
48192
48206
|
lines.push(
|
|
@@ -153050,13 +153064,15 @@ async function executeCommand(input, session) {
|
|
|
153050
153064
|
if (cmd.isBuiltin) {
|
|
153051
153065
|
return executeBuiltin(cmd, session, ctx);
|
|
153052
153066
|
}
|
|
153053
|
-
|
|
153054
|
-
|
|
153055
|
-
|
|
153056
|
-
|
|
153057
|
-
|
|
153058
|
-
|
|
153067
|
+
const firstWord = cmd.args[0]?.toLowerCase() ?? "";
|
|
153068
|
+
const hasExtension = extensionRegistry.hasExtension(firstWord);
|
|
153069
|
+
const isDomainCommand = isValidDomain(firstWord) || isCustomDomain(firstWord) || hasExtension;
|
|
153070
|
+
if (isDomainCommand) {
|
|
153071
|
+
if (!ctx.isRoot()) {
|
|
153072
|
+
ctx.reset();
|
|
153059
153073
|
}
|
|
153074
|
+
const domainArgs = cmd.args.slice(1);
|
|
153075
|
+
return handleDomainNavigation(firstWord, domainArgs, ctx, session);
|
|
153060
153076
|
}
|
|
153061
153077
|
return await executeAPICommand(session, ctx, cmd);
|
|
153062
153078
|
}
|