UNPKG

@taizo-pro/github-discussions-cli

Version:

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

53 lines 1.18 kB
import ora from 'ora'; import chalk from 'chalk'; export class Spinner { spinner; constructor() { this.spinner = null; } start(text) { this.spinner = ora({ text, spinner: 'dots', color: 'cyan', }).start(); } update(text) { if (this.spinner) { this.spinner.text = text; } } succeed(text) { if (this.spinner) { this.spinner.succeed(text || this.spinner.text); this.spinner = null; } } fail(text) { if (this.spinner) { this.spinner.fail(text || this.spinner.text); this.spinner = null; } } warn(text) { if (this.spinner) { this.spinner.warn(text || this.spinner.text); this.spinner = null; } } stop() { if (this.spinner) { this.spinner.stop(); this.spinner = null; } } info(text) { if (this.spinner) { this.spinner.info(text); } else { console.log(chalk.blue('ℹ'), text); } } } //# sourceMappingURL=spinner.js.map