@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +14 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
4
4
  "description": "CLI и AI-агент городского округа Йошкар-Ола.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/adm-iola/iola-cli#readme",
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
- printTable(links, [
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();