UNPKG

@gameroom/cli

Version:

A command line tool for Gameroom

50 lines (46 loc) 894 B
const ora = require('ora') class Spinner { constructor() { this.ora = ora() } get text() { return this.ora.text } set text(t) { this.ora.text = t } get isSpinning() { return this.ora.isSpinning } start(s) { this.ora.start(s) return this } info(s) { this.ora.info(s).start() if (!process.stdout.isTTY) console.log(`info: ${s}`) return this } warn(s) { this.ora.warn(s).start() if (!process.stdout.isTTY) console.log(`warn: ${s}`) return this } fail(s) { this.ora.fail(s) if (!process.stdout.isTTY) console.log(`fail: ${s}`) return this } succeed(s) { this.ora.succeed(s).start() if (!process.stdout.isTTY) console.log(`succeed: ${s}`) return this } stop() { this.ora.stop() process.stdin.resume() return this } } const spinner = new Spinner() module.exports = spinner