@iola_adm/iola-cli 0.1.42 → 0.1.43
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/package.json +1 -1
- package/src/cli.js +14 -4
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -2232,16 +2232,26 @@ async function handleWiki(args) {
|
|
|
2232
2232
|
}
|
|
2233
2233
|
|
|
2234
2234
|
if (action === "links" || action === "list" || action === "ls") {
|
|
2235
|
-
|
|
2236
|
-
["title", "Раздел"],
|
|
2237
|
-
["url", "Ссылка"],
|
|
2238
|
-
]);
|
|
2235
|
+
printWikiLinks(links);
|
|
2239
2236
|
return;
|
|
2240
2237
|
}
|
|
2241
2238
|
|
|
2242
2239
|
throw new Error("Команды wiki: links, open.");
|
|
2243
2240
|
}
|
|
2244
2241
|
|
|
2242
|
+
function printWikiLinks(links) {
|
|
2243
|
+
if (links.length === 0) {
|
|
2244
|
+
console.log("Нет данных.");
|
|
2245
|
+
return;
|
|
2246
|
+
}
|
|
2247
|
+
const titleWidth = Math.max("Раздел".length, ...links.map((link) => visibleLength(link.title)));
|
|
2248
|
+
console.log(`${padCell("Раздел", titleWidth)} Ссылка`);
|
|
2249
|
+
console.log(`${"-".repeat(titleWidth)} ${"-".repeat(6)}`);
|
|
2250
|
+
for (const link of links) {
|
|
2251
|
+
console.log(`${padCell(link.title, titleWidth)} ${link.url}`);
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2245
2255
|
async function handleContext(args) {
|
|
2246
2256
|
const [action = "list"] = args;
|
|
2247
2257
|
const files = await listContextFiles();
|