()
| 46 | let selected = loadLastChoice() |
| 47 | |
| 48 | function render() { |
| 49 | process.stdout.write(`\x1b[${options.length}A`) |
| 50 | for (let i = 0; i < options.length; i++) { |
| 51 | const prefix = i === selected ? '\x1b[36m❯\x1b[0m' : ' ' |
| 52 | const text = i === selected ? `\x1b[1m${options[i].label}\x1b[0m` : options[i].label |
| 53 | process.stdout.write(`\x1b[2K ${prefix} ${text}\n`) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | function run() { |
| 58 | console.log('\n\x1b[1mSelect dev mode:\x1b[0m (↑↓ to move, Enter to confirm)\n') |