UNPKG

@sharksv/hyper

Version:

A CLI to bootstrap new projects!

52 lines (51 loc) 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Clrs_1 = require("../Utils/Clrs"); // prettier-ignore const { red, cyan, green, yellow, bgRed, bgCyan, bgGreen, bgYellow } = Clrs_1.default; const Symbols = { Info: cyan('ℹ'), Pass: green('✔'), Error: red('✖'), Warning: yellow('⚠') }; /** * 📟 Prints out a prettified message to the console. * @param {string} type Print type (pass, error, warning, info) * @param {string} msg Message to print * @example * ```ts * import { Print } from '...' * Print('warning', 'a very serious warning!') * ``` */ function Print(Type, Msg) { const pType = Type.toLowerCase(); let Sym; let Clr; let Bg; switch (pType) { case 'pass': Bg = bgGreen; Sym = Symbols.Pass; Clr = green; break; case 'error': Bg = bgRed; Sym = Symbols.Error; Clr = red; break; case 'warning': Bg = bgYellow; Sym = Symbols.Warning; Clr = yellow; break; default: Bg = bgCyan; Sym = Symbols.Info; Clr = cyan; break; } console.log(`\n${Sym} ${Bg(` ${Type} `)} ${Clr(Msg)}\n`); } exports.default = Print;