@robinmordasiewicz/f5xc-xcsh 1.0.82-2601011720 → 1.0.82-2601012015
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 +121 -118
- 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-2601012015") {
|
|
45396
|
+
return "v1.0.82-2601012015";
|
|
45397
45397
|
}
|
|
45398
45398
|
if (process.env.XCSH_VERSION) {
|
|
45399
45399
|
return process.env.XCSH_VERSION;
|
|
@@ -46655,6 +46655,120 @@ function formatAPIError(statusCode, body, operation) {
|
|
|
46655
46655
|
return lines.join("\n");
|
|
46656
46656
|
}
|
|
46657
46657
|
|
|
46658
|
+
// src/output/domain-formatter.ts
|
|
46659
|
+
function parseDomainOutputFlags(args, sessionFormat = "table") {
|
|
46660
|
+
const { format: parsedFormat, remainingArgs } = parseOutputFlag(args);
|
|
46661
|
+
let noColor = false;
|
|
46662
|
+
const finalArgs = [];
|
|
46663
|
+
for (const arg of remainingArgs) {
|
|
46664
|
+
if (arg === "--no-color") {
|
|
46665
|
+
noColor = true;
|
|
46666
|
+
} else {
|
|
46667
|
+
finalArgs.push(arg);
|
|
46668
|
+
}
|
|
46669
|
+
}
|
|
46670
|
+
const effectiveNoColor = noColor || !shouldUseColors();
|
|
46671
|
+
return {
|
|
46672
|
+
options: {
|
|
46673
|
+
format: parsedFormat ?? sessionFormat,
|
|
46674
|
+
noColor: effectiveNoColor
|
|
46675
|
+
},
|
|
46676
|
+
remainingArgs: finalArgs
|
|
46677
|
+
};
|
|
46678
|
+
}
|
|
46679
|
+
function formatDomainOutput(data, options) {
|
|
46680
|
+
const { format, noColor } = options;
|
|
46681
|
+
if (format === "none") {
|
|
46682
|
+
return [];
|
|
46683
|
+
}
|
|
46684
|
+
const formatted = formatOutput(data, format, noColor);
|
|
46685
|
+
if (formatted === "") {
|
|
46686
|
+
return [];
|
|
46687
|
+
}
|
|
46688
|
+
return formatted.split("\n");
|
|
46689
|
+
}
|
|
46690
|
+
function formatKeyValueOutput(data, options) {
|
|
46691
|
+
const { format, noColor, title } = options;
|
|
46692
|
+
if (format === "none") {
|
|
46693
|
+
return [];
|
|
46694
|
+
}
|
|
46695
|
+
if (format === "json") {
|
|
46696
|
+
return formatJSON(data).split("\n");
|
|
46697
|
+
}
|
|
46698
|
+
if (format === "yaml") {
|
|
46699
|
+
return formatYAML(data).split("\n");
|
|
46700
|
+
}
|
|
46701
|
+
if (format === "tsv") {
|
|
46702
|
+
const lines = [];
|
|
46703
|
+
for (const [key, value] of Object.entries(data)) {
|
|
46704
|
+
if (value !== null && value !== void 0) {
|
|
46705
|
+
lines.push(`${key} ${String(value)}`);
|
|
46706
|
+
}
|
|
46707
|
+
}
|
|
46708
|
+
return lines;
|
|
46709
|
+
}
|
|
46710
|
+
const boxData = [];
|
|
46711
|
+
for (const [key, value] of Object.entries(data)) {
|
|
46712
|
+
if (value !== null && value !== void 0) {
|
|
46713
|
+
const label = formatLabel(key);
|
|
46714
|
+
boxData.push({ label, value: String(value) });
|
|
46715
|
+
}
|
|
46716
|
+
}
|
|
46717
|
+
if (boxData.length === 0) {
|
|
46718
|
+
return [];
|
|
46719
|
+
}
|
|
46720
|
+
const boxOutput = formatKeyValueBox(boxData, title ?? "Info", noColor);
|
|
46721
|
+
return boxOutput.split("\n");
|
|
46722
|
+
}
|
|
46723
|
+
function formatListOutput(data, options) {
|
|
46724
|
+
const { format, noColor } = options;
|
|
46725
|
+
if (format === "none") {
|
|
46726
|
+
return [];
|
|
46727
|
+
}
|
|
46728
|
+
if (format === "json") {
|
|
46729
|
+
return formatJSON(data).split("\n");
|
|
46730
|
+
}
|
|
46731
|
+
if (format === "yaml") {
|
|
46732
|
+
return formatYAML(data).split("\n");
|
|
46733
|
+
}
|
|
46734
|
+
if (format === "tsv") {
|
|
46735
|
+
if (data.length === 0) {
|
|
46736
|
+
return [];
|
|
46737
|
+
}
|
|
46738
|
+
const firstItem = data[0];
|
|
46739
|
+
if (typeof firstItem !== "object" || firstItem === null) {
|
|
46740
|
+
return data.map((item) => String(item));
|
|
46741
|
+
}
|
|
46742
|
+
const keys = Object.keys(firstItem);
|
|
46743
|
+
const lines = [];
|
|
46744
|
+
for (const item of data) {
|
|
46745
|
+
if (typeof item === "object" && item !== null) {
|
|
46746
|
+
const record = item;
|
|
46747
|
+
const values = keys.map((k) => {
|
|
46748
|
+
const val = record[k];
|
|
46749
|
+
if (val === null || val === void 0) return "";
|
|
46750
|
+
if (typeof val === "object") return JSON.stringify(val);
|
|
46751
|
+
return String(val);
|
|
46752
|
+
});
|
|
46753
|
+
lines.push(values.join(" "));
|
|
46754
|
+
}
|
|
46755
|
+
}
|
|
46756
|
+
return lines;
|
|
46757
|
+
}
|
|
46758
|
+
const tableOutput = formatResourceTable(data, noColor);
|
|
46759
|
+
if (tableOutput === "") {
|
|
46760
|
+
return [];
|
|
46761
|
+
}
|
|
46762
|
+
return tableOutput.split("\n");
|
|
46763
|
+
}
|
|
46764
|
+
function formatLabel(key) {
|
|
46765
|
+
if (key.includes("_")) {
|
|
46766
|
+
return key.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
46767
|
+
}
|
|
46768
|
+
const withSpaces = key.replace(/([A-Z])/g, " $1");
|
|
46769
|
+
return withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1);
|
|
46770
|
+
}
|
|
46771
|
+
|
|
46658
46772
|
// src/config/envvars.ts
|
|
46659
46773
|
var EnvVarRegistry = [
|
|
46660
46774
|
{
|
|
@@ -48841,120 +48955,6 @@ function useHistory(options) {
|
|
|
48841
48955
|
// src/repl/hooks/useCompletion.ts
|
|
48842
48956
|
var import_react27 = __toESM(require_react(), 1);
|
|
48843
48957
|
|
|
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
|
-
|
|
48958
48958
|
// src/domains/login/profile/list.ts
|
|
48959
48959
|
var listCommand = {
|
|
48960
48960
|
name: "list",
|
|
@@ -53520,9 +53520,12 @@ async function executeAPICommand(session, ctx, cmd) {
|
|
|
53520
53520
|
}
|
|
53521
53521
|
}
|
|
53522
53522
|
const effectiveFormat = outputFormat ?? session.getOutputFormat();
|
|
53523
|
-
const formatted =
|
|
53523
|
+
const formatted = formatDomainOutput(result, {
|
|
53524
|
+
format: effectiveFormat,
|
|
53525
|
+
noColor: noColor ?? false
|
|
53526
|
+
});
|
|
53524
53527
|
return {
|
|
53525
|
-
output: formatted ?
|
|
53528
|
+
output: formatted.length > 0 ? formatted : ["(no output)"],
|
|
53526
53529
|
shouldExit: false,
|
|
53527
53530
|
shouldClear: false,
|
|
53528
53531
|
contextChanged: false
|