bfi-cli 0.1.13 → 0.1.14

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/dist/cli.mjs +17 -5
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -6773,8 +6773,20 @@ async function runWhoami(globalOpts) {
6773
6773
  console.log(`\n用户名: ${displayName}`);
6774
6774
  console.log(`用户ID: ${userId}`);
6775
6775
  if (Array.isArray(namespaces) && namespaces.length > 0) {
6776
- const maxSlug = Math.max(...namespaces.map((ns) => String(ns.slug || "").length), 4);
6777
- const maxName = Math.max(...namespaces.map((ns) => String(ns.displayName || "").length), 4);
6776
+ const displayWidth = (s) => {
6777
+ let w = 0;
6778
+ for (const ch of s) w += /[一-鿿 -〿＀-￯]/.test(ch) ? 2 : 1;
6779
+ return w;
6780
+ };
6781
+ const padToWidth = (s, w) => {
6782
+ let result = s;
6783
+ while (displayWidth(result) < w) result += " ";
6784
+ return result;
6785
+ };
6786
+ const slugs = namespaces.map((ns) => String(ns.slug || ""));
6787
+ const names = namespaces.map((ns) => String(ns.displayName || ""));
6788
+ const col1 = Math.max(...slugs.map((s) => displayWidth(s)), 4) + 1;
6789
+ const col2 = Math.max(...names.map((s) => displayWidth(s)), 4);
6778
6790
  console.log(`\n命名空间 (${namespaces.length}):`);
6779
6791
  for (const ns of namespaces) {
6780
6792
  const role = ns.role || "MEMBER";
@@ -6784,9 +6796,9 @@ async function runWhoami(globalOpts) {
6784
6796
  MEMBER: "成员",
6785
6797
  VIEWER: "访客"
6786
6798
  };
6787
- const slug = String(ns.slug || "").padEnd(maxSlug);
6788
- const name = String(ns.displayName || "").padEnd(maxName);
6789
- console.log(` @${slug} ${name} ${roleLabel[role] || role}`);
6799
+ const s1 = padToWidth(`@${ns.slug}`, col1);
6800
+ const s2 = padToWidth(String(ns.displayName || ""), col2);
6801
+ console.log(` ${s1} ${s2} ${roleLabel[role] || role}`);
6790
6802
  }
6791
6803
  }
6792
6804
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {