UNPKG

zephyr-agent

Version:
86 lines (85 loc) • 3.21 kB
"use strict"; var __webpack_require__ = {}; (()=>{ __webpack_require__.d = (exports1, getters, values)=>{ var define = (defs, kind)=>{ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, { enumerable: true, [kind]: defs[key] }); }; define(getters, "get"); define(values, "value"); }; })(); (()=>{ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop); })(); (()=>{ __webpack_require__.r = (exports1)=>{ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, { value: 'Module' }); Object.defineProperty(exports1, '__esModule', { value: true }); }; })(); var __webpack_exports__ = {}; __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, { joinSections: ()=>joinSections, renderKeyValueRows: ()=>renderKeyValueRows, renderList: ()=>renderList, renderSection: ()=>renderSection }); const external_picocolor_js_namespaceObject = require("./picocolor.js"); const INDENT = ' '; const toneAccent = { info: external_picocolor_js_namespaceObject.purple, warn: external_picocolor_js_namespaceObject.yellow, success: external_picocolor_js_namespaceObject.green, muted: external_picocolor_js_namespaceObject.gray }; const defaultTone = 'info'; const indentLine = (line)=>{ if (!line) return ''; return `${INDENT}${line}`; }; function renderSection(options) { const { title, subtitle, body = [], tone = defaultTone } = options; const accent = toneAccent[tone] ?? toneAccent[defaultTone]; const lines = []; if (title) lines.push(accent((0, external_picocolor_js_namespaceObject.bold)(title))); if (subtitle) lines.push(indentLine((0, external_picocolor_js_namespaceObject.dim)(subtitle))); if (body.length) lines.push(...body.filter((line)=>'string' == typeof line).map(indentLine)); return lines.join('\n'); } function renderKeyValueRows(rows) { if (!rows.length) return []; const maxLabelLength = Math.max(...rows.map(({ label })=>label.length)); return rows.map(({ label, value })=>{ const paddedLabel = label.padEnd(maxLabelLength, ' '); return `${(0, external_picocolor_js_namespaceObject.gray)(paddedLabel)} ${value}`; }); } function renderList(items) { return items.map((item)=>`- ${item}`); } function joinSections(sections) { return sections.filter((section)=>Boolean(section)).join('\n'); } exports.joinSections = __webpack_exports__.joinSections; exports.renderKeyValueRows = __webpack_exports__.renderKeyValueRows; exports.renderList = __webpack_exports__.renderList; exports.renderSection = __webpack_exports__.renderSection; for(var __rspack_i in __webpack_exports__)if (-1 === [ "joinSections", "renderKeyValueRows", "renderList", "renderSection" ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i]; Object.defineProperty(exports, '__esModule', { value: true }); //# sourceMappingURL=cli-format.js.map