UNPKG

@twilio/plugin-microvisor

Version:

Interact with your Twilio Microvisor devices

88 lines (87 loc) 2.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseCommand = void 0; const tslib_1 = require("tslib"); exports.BaseCommand = require('@twilio/cli-core').baseCommands.BaseCommand; const node_process_1 = tslib_1.__importDefault(require("node:process")); class MicrovisorAbout extends exports.BaseCommand { async run() { await super.run(); const castNames = [ "Randy Beiter", "Richard Bowker", "Jonathan Dillon", "Anton Gerasimov", "Barry Gilbey", "Dmitry Iakovlev", "Agung Mandala", "Phil Michaelson-Yeates", "Nigel Rook", "Tony Smith", "Dhruv Vemula", "Jonathan Williams" ]; const honourables = [ "Joe Birr-Pixton", "Toby Duckworth", "Hugo Fiennes", "Peter Hartley", "Andrew Houghton", "Roger Lipscombe", "Tejas Patil" ]; var maxLength = 0; castNames.forEach(function (aName) { if (aName.length > maxLength) maxLength = aName.length; }); const spaces = " ".repeat(maxLength); printout("\u001B[?25l", 0); printout("Microvisor was brought to you by...", 1.5); printout("\r ", 0.5); castNames.forEach(function (aName) { for (var i = 0; i < aName.length + 1; i += 1) { var scrollOut = "\r" + aName.substring(aName.length - i - 1); printout(scrollOut, 0.03); } sleep(1.5); printout("\r" + spaces, 0); }); printout("\rWith contributions from...", 1.2); printout("\r ", 0.5); honourables.forEach(function (aName) { for (var i = 0; i < aName.length + 1; i += 1) { var scrollOut = "\r" + aName.substring(aName.length - i - 1); printout(scrollOut, 0.03); } sleep(1.2); printout("\r" + spaces, 0); }); printout("\r\u001B[?25h", 0); } async runCommand() { return run(); } } exports.default = MicrovisorAbout; MicrovisorAbout.description = "About Microvisor..."; function showErrorThenExit(base, msg) { base.logger.info(`[ERROR] ${msg}`); node_process_1.default.exit(1); } function sleep(s) { if (s == 0) return; const delay = s * 1000; const start = new Date().getTime(); while (new Date().getTime() < start + delay) ; } function printout(msg, delay) { node_process_1.default.stdout.write(msg); sleep(delay); } // Remove some unnecessary options delete MicrovisorAbout.flags['cli-output-format']; delete MicrovisorAbout.flags.silent; delete MicrovisorAbout.flags.profile;