@lonu/stc
Version:
A tool for converting OpenApi/Swagger/Apifox into code.
93 lines • 3.28 kB
TypeScript
import * as dntShim from "../../../../../_dnt.shims.js";
import { type prettyTimeOptions } from "./time.js";
export { MultiProgressBar } from "./multi.js";
interface constructorOptions {
title?: string;
total?: number;
width?: number;
complete?: string;
preciseBar?: string[];
incomplete?: string;
clear?: boolean;
interval?: number;
display?: string;
prettyTime?: boolean;
output?: typeof dntShim.Deno.stdout | typeof dntShim.Deno.stderr;
}
interface renderOptions {
title?: string;
total?: number;
text?: string;
complete?: string;
preciseBar?: string[];
incomplete?: string;
prettyTimeOptions?: prettyTimeOptions;
}
/**
* ProgressBar single progress bar.
*/
export default class ProgressBar {
#private;
title: string;
total?: number;
width: number;
complete: string;
preciseBar: string[];
incomplete: string;
clear: boolean;
interval: number;
display: string;
prettyTime: boolean;
private lastStr;
private lastStrLen;
private start;
private lastRenderTime;
private encoder;
private writer;
/**
* Title, total, complete, incomplete, can also be set or changed in the render method
*
* - title Progress bar title, default: ''
* - total total number of ticks to complete,
* - width the displayed width of the progress, default: 50
* - complete completion character, default: colors.bgGreen(' '), can use any string
* - incomplete incomplete character, default: colors.bgWhite(' '), can use any string
* - clear clear the bar on completion, default: false
* - interval minimum time between updates in milliseconds, default: 16
* - display What is displayed and display order, default: ':title :percent :bar :time :completed/:total'
* - prettyTime Whether to pretty print time and eta
* - output Output stream, can be Deno.stdout or Deno.stderr, default is Deno.stdout
*/
constructor({ title, total, width, complete, preciseBar, incomplete, clear, interval, display, prettyTime, output, }?: constructorOptions);
/**
* "render" the progress bar
*
* - `completed` completed value
* - `options` optional parameters
* - `title` progress bar title
* - `total` total number of ticks to complete
* - `text` optional, custom text, default: ''
* - `complete` completion character, If you want to change at a certain moment. For example, it turns red at 20%
* - `incomplete` incomplete character, If you want to change at a certain moment. For example, it turns red at 20%
* - `prettyTimeOptions` prettyTime options
*/
render(completed: number, options?: renderOptions): Promise<void>;
/**
* end: end a progress bar.
* No need to call in most cases, unless you want to end before 100%
*/
end(): Promise<void>;
/**
* interrupt the progress bar and write a message above it
*
* @param message The message to write
*/
console(message: string | number): Promise<void>;
private write;
private get ttyColumns();
private breakLine;
private stdoutWrite;
private clearLine;
private showCursor;
}
//# sourceMappingURL=mod.d.ts.map