mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 01:01:23 +00:00
refactor(daemon): dedupe install output line writing
This commit is contained in:
@@ -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`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user