| 41 | |
| 42 | // Wrap `text` to `width` columns, prefixing every line with `indent`. |
| 43 | function wrapText(text: string, indent: string, width: number): string[] { |
| 44 | const words = text.split(/\s+/); |
| 45 | const lines: string[] = []; |
| 46 | let current = ''; |
| 47 | for (const word of words) { |
| 48 | if (current.length > 0 && (current.length + 1 + word.length) > width) { |
| 49 | lines.push(indent + current); |
| 50 | current = word; |
| 51 | } else { |
| 52 | current = current.length > 0 ? `${current} ${word}` : word; |
| 53 | } |
| 54 | } |
| 55 | if (current.length > 0) { |
| 56 | lines.push(indent + current); |
| 57 | } |
| 58 | return lines; |
| 59 | } |
| 60 | |
| 61 | function openBrowser(url: string): void { |
| 62 | const cmd = process.platform === 'darwin' ? 'open' |