(text: string, width: number)
| 173 | function visibleOptions(command: Command): [string, Option][] { |
| 174 | return Object.entries(command.options || {}).filter(([name]) => !HIDDEN_OPTIONS.has(name)) as [ |
| 175 | string, |
| 176 | Option, |
| 177 | ][]; |
| 178 | } |
| 179 | |
| 180 | /** Last segment of the long option name (e.g. conflict-strategy → STRATEGY). */ |
| 181 | function getOptionVariableName(longName: string): string { |
| 182 | const segments = longName.split('-').filter(Boolean); |
| 183 | const base = segments.length ? segments[segments.length - 1]! : longName; |
| 184 | return base.toUpperCase(); |
| 185 | } |
| 186 | |
| 187 | export function wrapText(text: string, width: number): string[] { |
| 188 | if (!text) { |
| 189 | return ['']; |
| 190 | } |
| 191 | |
| 192 | const lines: string[] = []; |
| 193 | for (const paragraph of text.trim().split('\n')) { |
| 194 | const trimmed = paragraph.trim(); |
| 195 | if (!trimmed) { |
| 196 | lines.push(''); |
| 197 | continue; |
| 198 | } |
| 199 | |
| 200 | let line = ''; |
no outgoing calls
no test coverage detected