pi-tui-status-beautifier 1.3.1 → 1.3.2
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.
|
@@ -179,6 +179,14 @@ export function beautifyStatus(
|
|
|
179
179
|
const numberMatch = cleanVal.match(NUMBER_PATTERN);
|
|
180
180
|
if (numberMatch) {
|
|
181
181
|
details = numberMatch[1];
|
|
182
|
+
} else {
|
|
183
|
+
// If no numeric metric exists, extract the status word descriptor (e.g. "ready", "idle", "cleanup")
|
|
184
|
+
const wordMatch = cleanVal.match(
|
|
185
|
+
/(?::\s*|\b)(ready|idle|ok|done|failed|waiting|cleanup|active|online|offline|running|paused|error|success|connected|disconnected)\b/i
|
|
186
|
+
);
|
|
187
|
+
if (wordMatch) {
|
|
188
|
+
details = wordMatch[1].toLowerCase();
|
|
189
|
+
}
|
|
182
190
|
}
|
|
183
191
|
}
|
|
184
192
|
}
|
|
@@ -484,7 +492,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
484
492
|
originalStatuses.clear();
|
|
485
493
|
lastRenderedStatus.clear();
|
|
486
494
|
|
|
487
|
-
//
|
|
495
|
+
// Hook setStatus for clean status badge formatting (never hijack Pi's native footer)
|
|
488
496
|
const originalSetStatus = ctx.ui.setStatus;
|
|
489
497
|
if (originalSetStatus && !(originalSetStatus as any).__beautifierHooked) {
|
|
490
498
|
const wrapped = function (key: string, value: string | undefined) {
|
|
@@ -503,25 +511,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
503
511
|
(wrapped as any).__beautifierHooked = true;
|
|
504
512
|
ctx.ui.setStatus = wrapped;
|
|
505
513
|
}
|
|
506
|
-
|
|
507
|
-
// 2. Hook setFooter for full-footer beautification
|
|
508
|
-
if (typeof (ctx.ui as any).setFooter === "function") {
|
|
509
|
-
(ctx.ui as any).setFooter((tui: any, theme: any, footerData: any) => {
|
|
510
|
-
const unsub =
|
|
511
|
-
typeof footerData?.onBranchChange === "function"
|
|
512
|
-
? footerData.onBranchChange(() => tui.requestRender())
|
|
513
|
-
: undefined;
|
|
514
|
-
|
|
515
|
-
return {
|
|
516
|
-
dispose: unsub,
|
|
517
|
-
invalidate() {},
|
|
518
|
-
render(width: number): string[] {
|
|
519
|
-
if (currentStyle === "off") return [];
|
|
520
|
-
return renderBeautifiedFooter(width, tui, theme, footerData, ctx, currentStyle, customStyleConfig);
|
|
521
|
-
},
|
|
522
|
-
};
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
514
|
});
|
|
526
515
|
|
|
527
516
|
// Dynamic status bar style controller registry
|
package/package.json
CHANGED