MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / renderProgress

Function renderProgress

packages/cli/src/ui/progress.ts:5–18  ·  view source on GitHub ↗
(percent: number, stage: string, row?: number)

Source from the content-addressed store, hash-verified

3const { stdout } = process;
4
5export function renderProgress(percent: number, stage: string, row?: number): void {
6 const width = 25;
7 const filled = Math.floor(percent / (100 / width));
8 const empty = width - filled;
9 const bar = c.progress("\u2588".repeat(filled)) + c.dim("\u2591".repeat(empty));
10
11 const line = ` ${bar} ${c.bold(String(Math.round(percent)) + "%")} ${c.dim(stage)}`;
12
13 if (row !== undefined && stdout.isTTY) {
14 stdout.write(`\x1b[${row};1H\x1b[2K${line}`);
15 } else {
16 stdout.write(`\r\x1b[2K${line}`);
17 }
18}

Callers 1

renderLocalFunction · 0.85

Calls 1

writeMethod · 0.65

Tested by

no test coverage detected