UNPKG

sourcecontrol

Version:

A modern TypeScript CLI application for source control

52 lines 2.25 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.display = exports.createSeparator = exports.formatLabelValue = exports.displayBox = exports.createDisplayBox = exports.DisplayThemes = void 0; const boxen_1 = __importDefault(require("boxen")); const chalk_1 = __importDefault(require("chalk")); const DEFAULT_BOX_OPTIONS = { padding: 1, margin: { top: 1, bottom: 1, left: 1, right: 1 }, borderStyle: 'round', backgroundColor: 'black', titleAlignment: 'center', }; exports.DisplayThemes = { INFO: 'blue', SUCCESS: 'green', WARNING: 'yellow', ERROR: 'red', NEUTRAL: 'gray', HIGHLIGHT: 'magenta', }; const createDisplayBox = (content, options = {}) => { const { theme = exports.DisplayThemes.INFO, customBorderColor } = options; const boxOptions = { ...DEFAULT_BOX_OPTIONS, borderColor: customBorderColor || theme, }; return (0, boxen_1.default)(content, boxOptions); }; exports.createDisplayBox = createDisplayBox; const displayBox = (content, options = {}) => { console.log((0, exports.createDisplayBox)(content, options)); }; exports.displayBox = displayBox; const formatLabelValue = (label, value) => { return `${chalk_1.default.gray(`${label}:`)} ${value}`; }; exports.formatLabelValue = formatLabelValue; const createSeparator = (length = 50, char = '─') => { return chalk_1.default.gray(char.repeat(length)); }; exports.createSeparator = createSeparator; exports.display = { success: (content, title) => (0, exports.displayBox)(content, { theme: exports.DisplayThemes.SUCCESS, title }), error: (content, title) => (0, exports.displayBox)(content, { theme: exports.DisplayThemes.ERROR, title }), warning: (content, title) => (0, exports.displayBox)(content, { theme: exports.DisplayThemes.WARNING, title }), info: (content, title) => (0, exports.displayBox)(content, { theme: exports.DisplayThemes.INFO, title }), highlight: (content, title) => (0, exports.displayBox)(content, { theme: exports.DisplayThemes.HIGHLIGHT, title }), }; //# sourceMappingURL=display.js.map