(longName: string, opt: Option)
| 112 | if (opt.multiple) { |
| 113 | token += '...'; |
| 114 | } |
| 115 | } |
| 116 | return optional ? `[${token}]` : token; |
| 117 | } |
| 118 | |
| 119 | function printOptionManualRow(longName: string, opt: Option) { |
| 120 | const synopsis = buildCommandSynopsisOptionColumn(longName, opt); |
| 121 | const description = buildCommandOptionDescription(opt); |
| 122 | const descriptionWidth = Math.max(24, 80 - OPTION_DESCRIPTION_PAD.length); |
| 123 | const descriptionLines = wrapText(description, descriptionWidth); |
| 124 | |
| 125 | if (synopsis.length > OPTION_COLUMN_WIDTH) { |
| 126 | console.log(`${ROW_INDENT}${synopsis}`); |
| 127 | for (const line of descriptionLines) { |
| 128 | console.log(`${OPTION_DESCRIPTION_PAD}${line}`); |
| 129 | } |
| 130 | return; |
| 131 | } |
| 132 | |
| 133 | console.log(`${ROW_INDENT}${synopsis.padEnd(OPTION_COLUMN_WIDTH)}${descriptionLines[0] ?? ''}`); |
| 134 | for (let i = 1; i < descriptionLines.length; i++) { |
| 135 | console.log(`${OPTION_DESCRIPTION_PAD}${descriptionLines[i]}`); |
no test coverage detected