bfi-cli 0.1.12 → 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 +19 -2
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -6773,15 +6773,32 @@ 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 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);
6776
6790
  console.log(`\n命名空间 (${namespaces.length}):`);
6777
6791
  for (const ns of namespaces) {
6778
6792
  const role = ns.role || "MEMBER";
6779
- console.log(` @${ns.slug} ${ns.displayName || ""} [${{
6793
+ const roleLabel = {
6780
6794
  OWNER: "拥有者",
6781
6795
  ADMIN: "管理员",
6782
6796
  MEMBER: "成员",
6783
6797
  VIEWER: "访客"
6784
- }[role] || role}]`);
6798
+ };
6799
+ const s1 = padToWidth(`@${ns.slug}`, col1);
6800
+ const s2 = padToWidth(String(ns.displayName || ""), col2);
6801
+ console.log(` ${s1} ${s2} ${roleLabel[role] || role}`);
6785
6802
  }
6786
6803
  }
6787
6804
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {