Spinner & Progress
Spinner
Section titled “Spinner”import { createSpinner } from "@arshad-shah/clif";
const spinner = createSpinner({ text: "Installing dependencies..." });spinner.start();
// Update mid-taskspinner.update("Compiling TypeScript...");
// Finish with a statespinner.succeed("Build complete");// orspinner.fail("Build failed");spinner.warn("Build succeeded with warnings");spinner.info("Build skipped — no changes");Spinner options
Section titled “Spinner options”| Option | Type | Default | Description |
|---|---|---|---|
text | string | "" | Spinner label |
frames | string[] | braille dots | Animation frames |
interval | number | 80 | Frame interval (ms) |
color | Formatter | cyan | Frame color |
stream | WritableStream | stderr | Output stream |
prefixText | string | "" | Text printed before the frame/icon on every line (e.g. a step counter) |
suffixText | string | "" | Text printed after the label on every line |
Progress bar
Section titled “Progress bar”import { createProgress } from "@arshad-shah/clif";
const bar = createProgress({ total: 100 });
for (let i = 0; i < 100; i++) { await doWork(); bar.tick();}// █████████████████████████████░ 97% 97/100
// Or set absolute valuebar.update(50);Progress options
Section titled “Progress options”| Option | Type | Default | Description |
|---|---|---|---|
total | number | required | Total steps |
width | number | 30 | Bar width in chars |
complete | string | █ | Filled character |
incomplete | string | ░ | Empty character |
format | string | :bar :percent :current/:total | Output format |
color | Formatter | green | Bar color |
stream | WritableStream | stderr | Output stream |