MCPcopy Index your code
hub / github.com/MiniMax-AI/cli / createSpinner

Function createSpinner

src/output/progress.ts:9–39  ·  view source on GitHub ↗
(label: string)

Source from the content-addressed store, hash-verified

7}
8
9export function createSpinner(label: string): Spinner {
10 const isTTY = process.stderr.isTTY;
11 let frame = 0;
12 let interval: ReturnType<typeof setInterval> | null = null;
13 let currentLabel = label;
14
15 return {
16 start() {
17 if (!isTTY) return;
18 interval = setInterval(() => {
19 process.stderr.write(`\r${SPINNER_FRAMES[frame % SPINNER_FRAMES.length]} ${currentLabel}`);
20 frame++;
21 }, 80);
22 },
23 update(text: string) {
24 currentLabel = text;
25 },
26 stop(finalText?: string) {
27 if (interval) {
28 clearInterval(interval);
29 interval = null;
30 }
31 if (isTTY) {
32 process.stderr.write('\r\x1b[K');
33 if (finalText) {
34 process.stderr.write(`${finalText}\n`);
35 }
36 }
37 },
38 };
39}
40
41export interface ProgressBar {
42 update(current: number): void;

Callers 1

pollFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected