(value: string, width: number)
| 46 | } |
| 47 | |
| 48 | function pad(value: string, width: number): string { |
| 49 | // visible length excludes ANSI codes; our command labels are |
| 50 | // pre-styled so we measure the original string and re-style. |
| 51 | const visible = value.replace(/\x1b\[[0-9;]*m/g, '') |
| 52 | if (visible.length >= width) return value |
| 53 | return value + ' '.repeat(width - visible.length) |
| 54 | } |
| 55 | |
| 56 | function wrapLines(text: string, width: number): string[] { |
| 57 | // Soft-wrap a single descriptive paragraph at word boundaries. We |