refactor(daemon): dedupe install output line writing

This commit is contained in:
Peter Steinberger
2026-02-18 23:58:05 +00:00
parent 89a0b95af4
commit 2709c0ba51
4 changed files with 42 additions and 11 deletions

View File

@@ -6,3 +6,16 @@ export function formatLine(label: string, value: string): string {
const rich = isRich();
return `${colorize(rich, theme.muted, `${label}:`)} ${colorize(rich, theme.command, value)}`;
}
export function writeFormattedLines(
stdout: NodeJS.WritableStream,
lines: Array<{ label: string; value: string }>,
opts?: { leadingBlankLine?: boolean },
): void {
if (opts?.leadingBlankLine) {
stdout.write("\n");
}
for (const line of lines) {
stdout.write(`${formatLine(line.label, line.value)}\n`);
}
}