mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #46415 update(cli-progress): minor changes to 3.8 by @peterblazejewicz
- SingleBar.update overloaded - SingleBar.increment overloaded - SingleBar.updateETA added - Options.etaAsynchronousUpdate property added - version bump - mantainer added https://github.com/AndiDittrich/Node.CLI-Progress/compare/v3.6.1...v3.8.2 Thanks!
This commit is contained in:
parent
d22b577f01
commit
fae426721a
@ -31,8 +31,11 @@ function test1() {
|
||||
barIncompleteChar: '.',
|
||||
fps: 5,
|
||||
stream: process.stdout,
|
||||
barsize: 65
|
||||
barsize: 65,
|
||||
etaAsynchronousUpdate: true,
|
||||
});
|
||||
bar.calculateETA();
|
||||
bar.updateETA();
|
||||
}
|
||||
|
||||
function test2() {
|
||||
@ -96,12 +99,14 @@ function test6() {
|
||||
const bar2 = new progress.SingleBar({}, progress.Presets.shades_classic);
|
||||
bar2.increment();
|
||||
bar2.increment(10);
|
||||
bar2.increment({ speed: '42 kbps' });
|
||||
|
||||
// MultiBar
|
||||
const multiBar = new progress.MultiBar({}, progress.Presets.shades_classic);
|
||||
const subBar1 = multiBar.create(100, 0, {});
|
||||
const subBar2 = multiBar.create(100, 30, {});
|
||||
subBar1.update(50);
|
||||
subBar1.update({ speed: '42 kbps' });
|
||||
|
||||
subBar1.stop();
|
||||
|
||||
|
||||
16
types/cli-progress/index.d.ts
vendored
16
types/cli-progress/index.d.ts
vendored
@ -1,10 +1,9 @@
|
||||
// Type definitions for cli-progress 3.7
|
||||
// Type definitions for cli-progress 3.8
|
||||
// Project: https://github.com/AndiDittrich/Node.CLI-Progress
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Álvaro Martínez <https://github.com/alvaromartmart>
|
||||
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export interface Params {
|
||||
@ -84,6 +83,13 @@ export interface Options {
|
||||
/** number of updates with which to calculate the eta; higher numbers give a more stable eta (default: 10) */
|
||||
etaBuffer?: number;
|
||||
|
||||
/**
|
||||
* trigger an eta calculation update during asynchronous rendering trigger using the current value
|
||||
* - should only be used for long running processes in conjunction with lof `fps` values and large `etaBuffer`
|
||||
* @default false
|
||||
*/
|
||||
etaAsynchronousUpdate?: boolean;
|
||||
|
||||
/** disable line wrapping (default: false) - pass null to keep terminal settings; pass true to trim the output to terminal width */
|
||||
linewrap?: boolean | null;
|
||||
|
||||
@ -141,6 +147,8 @@ export class SingleBar {
|
||||
constructor(opt: Options, preset?: Preset);
|
||||
|
||||
calculateETA(): void;
|
||||
/** Force eta calculation update (long running processes) without altering the progress values. */
|
||||
updateETA(): void;
|
||||
|
||||
formatTime(t: any, roundToMultipleOf: any): any;
|
||||
|
||||
@ -148,6 +156,7 @@ export class SingleBar {
|
||||
|
||||
/** Increases the current progress value by a specified amount (default +1). Update payload optionally */
|
||||
increment(step?: number, payload?: object): void;
|
||||
increment(payload: object): void;
|
||||
|
||||
render(): void;
|
||||
|
||||
@ -164,6 +173,7 @@ export class SingleBar {
|
||||
|
||||
/** Sets the current progress value and optionally the payload with values of custom tokens as a second parameter */
|
||||
update(current: number, payload?: object): void;
|
||||
update(payload: object): void;
|
||||
}
|
||||
|
||||
export class MultiBar {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user