igir
Version:
🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.
96 lines (95 loc) • 3.42 kB
TypeScript
import Logger from './logger.js';
import { LogLevelValue } from './logLevel.js';
import ProgressBar from './progressBar.js';
/**
* A {@link ProgressBar} that is intended to print to a TTY CLI.
*/
export default class ProgressBarCLI extends ProgressBar {
private static readonly RENDER_MUTEX;
private static readonly FPS;
private static multiBar?;
private static progressBars;
private static lastRedraw;
private static logQueue;
private logger;
private readonly payload;
private readonly singleBarFormatted?;
private waitingMessageTimeout?;
private readonly waitingMessages;
private constructor();
/**
* Create a new {@link ProgressBarCLI}, and initialize the {@link MultiBar} if it hasn't been yet.
*/
static new(logger: Logger, name: string, symbol: string, initialTotal?: number): ProgressBarCLI;
/**
* Stop the {@link MultiBar} (and therefore everyProgressBar).
*/
static stop(): void;
/**
* Applications that are too synchronous or have a high concurrency (e.g. with async.js, p-limit,
* p-map, etc.) keep cli-progress from redrawing with its setTimeout(), so it might be necessary
* to force it. This function needs to be safe to be called concurrently because of the way
* cli-progress clears previous output.
* @see https://github.com/npkgz/cli-progress/issues/79
*/
render(force?: boolean): void;
/**
* Reset the {@link ProgressBar}'s progress to zero and change its total.
*/
reset(total: number): void;
private logPayload;
setName(name: string): void;
setSymbol(symbol: string): void;
/**
* If progress hasn't been made by some timeout period, then show a waiting message to let the
* user know that there is still something processing.
*/
addWaitingMessage(waitingMessage: string): void;
/**
* Remove a waiting message to let the user know some processing has finished.
*/
removeWaitingMessage(waitingMessage: string): void;
/**
* Increment the total by some amount.
*/
incrementTotal(increment: number): void;
/**
* Increment the in-progress count by one.
*/
incrementProgress(): void;
/**
* Decrement the in-progress count by one, and increment the completed count by one.
*/
incrementDone(): void;
/**
* Set the completed count.
*/
update(current: number): void;
/**
* Set the completed count to the total, and render any completion message.
*/
done(finishedMessage?: string): void;
/**
* Return a copy of this {@link ProgressBar} with a new string prefix.
*/
setLoggerPrefix(prefix: string): void;
/**
* Log a message at some specified {@link LogLevelValue}.
*/
log(logLevel: LogLevelValue, message: string): void;
/**
* Log a message at some specified {@link LogLevelValue}.
*/
static log(logger: Logger, logLevel: LogLevelValue, message: string): void;
/**
* When the number of progress bars exceeds the height of the console, cli-progress fails to be
* able to clear them all reliably. It's recommended you don't have too many active progress bars
* at once.
* @see https://github.com/npkgz/cli-progress/issues/59
*/
freeze(): void;
/**
* Delete this {@link ProgressBarCLI} from the CLI.
*/
delete(): void;
}