UNPKG

redirector-cli

Version:

Global CLI tool for managing Redirector backend services with Docker Compose

79 lines 2.45 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Logger = void 0; const chalk_1 = __importDefault(require("chalk")); const ora_1 = __importDefault(require("ora")); class Logger { static info(message) { console.log(chalk_1.default.blue("ℹ"), message); } static success(message) { console.log(chalk_1.default.green("✓"), message); } static warning(message) { console.log(chalk_1.default.yellow("⚠"), message); } static error(message) { console.error(chalk_1.default.red("✗"), message); } static debug(message) { if (process.env.DEBUG) { console.log(chalk_1.default.gray("🐛"), chalk_1.default.gray(message)); } } static startSpinner(message) { this.spinner = (0, ora_1.default)(message).start(); } static updateSpinner(message) { if (this.spinner) { this.spinner.text = message; } } static succeedSpinner(message) { if (this.spinner) { this.spinner.succeed(message); this.spinner = null; } } static failSpinner(message) { if (this.spinner) { this.spinner.fail(message); this.spinner = null; } } static stopSpinner() { if (this.spinner) { this.spinner.stop(); this.spinner = null; } } static header(message) { console.log(); console.log(chalk_1.default.bold.cyan("🚀 " + message)); console.log(chalk_1.default.cyan("─".repeat(message.length + 3))); } static subheader(message) { console.log(); console.log(chalk_1.default.bold(message)); } static list(items) { items.forEach((item) => { console.log(chalk_1.default.gray(" •"), item); }); } static table(data) { const maxKeyLength = Math.max(...Object.keys(data).map((k) => k.length)); Object.entries(data).forEach(([key, value]) => { console.log(chalk_1.default.gray(key.padEnd(maxKeyLength + 2, ".")), chalk_1.default.white(value)); }); } static newLine() { console.log(); } } exports.Logger = Logger; Logger.spinner = null; //# sourceMappingURL=logger.js.map