Add sf-tui shared utility functions.

Provides rightAlign helper for text alignment in terminal UI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
ace-pm 2026-04-15 16:16:39 +02:00
parent acab81de11
commit e501ffeefd

View file

@ -0,0 +1,8 @@
import { visibleWidth } from "@sf-run/pi-tui";
export function rightAlign(left: string, right: string, width: number): string {
const leftVis = visibleWidth(left);
const rightVis = visibleWidth(right);
const gap = Math.max(1, width - leftVis - rightVis);
return left + " ".repeat(gap) + right;
}