@limecloud/cli 0.10.0 → 0.11.0
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/README.md +7 -1
- package/dist/identity.json +4 -4
- package/dist/knowledge.json +1 -1
- package/dist/management.json +73 -2
- package/dist/skills.json +1 -1
- package/package.json +2 -2
- package/src/diagnose.mjs +42 -6
- package/src/group-task.mjs +20 -18
- package/src/locales/en.json +25 -0
- package/src/locales/zh-CN.json +25 -0
- package/src/output.mjs +5 -2
package/src/output.mjs
CHANGED
|
@@ -6,6 +6,9 @@ const columnLabels = {
|
|
|
6
6
|
command: "columns.command", operationId: "columns.operationId", method: "columns.method",
|
|
7
7
|
path: "columns.path", summary: "columns.summary", description: "columns.description", value: "columns.value",
|
|
8
8
|
check: "columns.check", status: "columns.status", message: "columns.message",
|
|
9
|
+
id: "columns.id", kind: "columns.kind", revision: "columns.revision", check_code: "columns.checkCode", error_code: "columns.errorCode",
|
|
10
|
+
redirect_uri_count: "columns.redirectCount", openid_enabled: "columns.openid", login_candidate: "columns.loginCandidate",
|
|
11
|
+
query: "columns.query", started_at: "columns.startedAt", observed_at: "columns.observedAt", field: "columns.field",
|
|
9
12
|
};
|
|
10
13
|
|
|
11
14
|
export function outputOptions(parsed) {
|
|
@@ -31,7 +34,7 @@ export function displayText(value) {
|
|
|
31
34
|
return result.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/[\x00-\x1f\x7f-\x9f]/g, " ");
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
export function success(io, value, { format = "json", fields, identity = "public", raw = false, meta = {} } = {}) {
|
|
37
|
+
export function success(io, value, { format = "json", fields, identity = "public", raw = false, meta = {}, tableTruncate = true } = {}) {
|
|
35
38
|
const data = select(raw ? value : redact(value), fields);
|
|
36
39
|
const rows = (Array.isArray(data) ? data : [data]).map((row) => row && typeof row === "object" && !Array.isArray(row) ? row : { value: row });
|
|
37
40
|
if (format === "json") {
|
|
@@ -46,7 +49,7 @@ export function success(io, value, { format = "json", fields, identity = "public
|
|
|
46
49
|
} else {
|
|
47
50
|
const headings = keys.map(key => Object.hasOwn(columnLabels, key) ? currentLocalizer().t(columnLabels[key]) : key);
|
|
48
51
|
const cells = [headings, ...rows.map((row) => keys.map((key) => displayText(row[key])))];
|
|
49
|
-
const widths = keys.map((_key, index) => Math.min(80, Math.max(...cells.map((row) => row[index].length))));
|
|
52
|
+
const widths = keys.map((_key, index) => Math.min(tableTruncate ? 80 : Infinity, Math.max(...cells.map((row) => row[index].length))));
|
|
50
53
|
io.stdout.write(`${cells.map((row) => row.map((cell, index) => displayText(cell).slice(0, widths[index]).padEnd(widths[index])).join(" ").trimEnd()).join("\n")}\n`);
|
|
51
54
|
}
|
|
52
55
|
}
|