| 596 | const inner = width - 2; |
| 597 | |
| 598 | function box(title: string, lines: string[]): string { |
| 599 | const top = `${tl}${h.repeat(inner)}${tr}`; |
| 600 | const mid = `${lm}${h.repeat(inner)}${rm}`; |
| 601 | const bot = `${bl}${h.repeat(inner)}${br}`; |
| 602 | const titleLine = `${v} ${title.padEnd(inner - 1)}${v}`; |
| 603 | const contentLines = lines.map((l) => { |
| 604 | const truncated = l.length > inner - 2 ? l.slice(0, inner - 5) + '...' : l; |
| 605 | return `${v} ${truncated.padEnd(inner - 2)}${v}`; |
| 606 | }); |
| 607 | return [top, titleLine, mid, ...contentLines, bot].join('\n'); |
| 608 | } |
| 609 | |
| 610 | const sections: string[] = []; |
| 611 | |