UNPKG

cli-block

Version:
26 lines 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.blockFooter = exports.createBlockFooter = void 0; const tools_1 = require("@sil/tools"); const settings_1 = require("../settings"); const util_1 = require("../util"); const border_1 = require("../border"); const blocks_line_1 = require("./blocks.line"); // Closing Block const createBlockFooter = (txt = null, settings = {}) => { const cfg = (0, settings_1.useSettings)(settings); let lines = []; cfg.autoSpace && lines.push((0, blocks_line_1.createBlockLine)(null, cfg)[0]); if (txt) lines.push(`${(0, util_1.spaces)(cfg.indentBlock)}${(0, border_1.border)(border_1.BorderElement.bottomStart, cfg)}${(0, tools_1.repeat)(Math.floor((0, settings_1.getFrameWidth)(cfg) / 3), (0, border_1.border)(border_1.BorderElement.endLine, cfg), true)}${(0, util_1.centerText)((0, util_1.bold)(txt), (0, settings_1.getFrameWidth)(cfg) - Math.floor((0, settings_1.getFrameWidth)(cfg) / 3) * 2)}${(0, tools_1.repeat)(Math.floor((0, settings_1.getFrameWidth)(cfg) / 3), `${(0, border_1.border)(border_1.BorderElement.endLine, cfg)}`, true)}${(0, border_1.border)(border_1.BorderElement.bottomEnd, cfg)}`); else lines.push(`${(0, util_1.spaces)(cfg.indentBlock)}${(0, border_1.border)(border_1.BorderElement.bottomStart, cfg)}${(0, tools_1.repeat)((0, settings_1.getFrameWidth)(cfg), `${(0, border_1.border)(border_1.BorderElement.endLine, cfg)}`, true)}${(0, border_1.border)(border_1.BorderElement.bottomEnd, cfg)}`); return lines; }; exports.createBlockFooter = createBlockFooter; const blockFooter = (txt = null, settings = {}) => { let lines = (0, exports.createBlockFooter)(txt, settings); lines.forEach((line) => (0, util_1.logger)(line, settings)); }; exports.blockFooter = blockFooter; //# sourceMappingURL=blocks.footer.js.map