flagstaff
API reference

flagstaff/progress

Every export of flagstaff/progress, with its signature and doc comment: progress, plus 2 types.

import { progress } from 'flagstaff/progress';

Functions

progress

A progress bar: 12/30 files · 40% off a terminal, a drawn bar on one.

function progress({ width, glyphs }?: ProgressOptions): Component<ProgressState>;
ParameterType
{ width, glyphs } (optional)ProgressOptions

Returns Component<ProgressState>

Interfaces

ProgressOptions

interface ProgressOptions {
    /** Cells the bar occupies on a terminal. Default 24. */
    width?: number;
    /** The two characters the bar is drawn with. Default `█` and `░`. */
    glyphs?: {
        filled: string;
        empty: string;
    };
}

ProgressState

interface ProgressState {
    /** Units done so far; clamped into `[0, total]` on the way out. */
    done: number;
    total: number;
    /** What is being counted, e.g. `files`. Read in both projections. */
    label?: string;
}

On this page