UNPKG

@taizo-pro/github-discussions-cli

Version:

A powerful command-line tool for interacting with GitHub Discussions without opening a browser

53 lines 1.48 kB
import cliProgress from 'cli-progress'; import chalk from 'chalk'; export class ProgressBar { bar; isActive = false; constructor() { this.bar = new cliProgress.SingleBar({ format: chalk.cyan('{bar}') + ' | {percentage}% | {value}/{total} items | {duration_formatted}', barCompleteChar: '█', barIncompleteChar: '░', hideCursor: true, clearOnComplete: true, }, cliProgress.Presets.shades_classic); } start(total, startValue = 0) { if (!this.isActive) { this.bar.start(total, startValue); this.isActive = true; } } update(value) { if (this.isActive) { this.bar.update(value); } } increment(delta = 1) { if (this.isActive) { this.bar.increment(delta); } } stop() { if (this.isActive) { this.bar.stop(); this.isActive = false; } } updateTotal(total) { if (this.isActive) { this.bar.setTotal(total); } } } export function createMultiProgress() { return new cliProgress.MultiBar({ format: chalk.cyan('{bar}') + ' | {percentage}% | {task}', barCompleteChar: '█', barIncompleteChar: '░', hideCursor: true, clearOnComplete: false, stopOnComplete: true, }, cliProgress.Presets.shades_classic); } //# sourceMappingURL=progress.js.map