(_input: string, key: { name?: string; ctrl?: boolean })
| 156 | }; |
| 157 | |
| 158 | const onKeypress = (_input: string, key: { name?: string; ctrl?: boolean }): void => { |
| 159 | if (key.name === 'up') { |
| 160 | selectedIndex = moveInstallPromptSelection(selectedIndex, 'up', choices.length); |
| 161 | render(); |
| 162 | return; |
| 163 | } |
| 164 | if (key.name === 'down') { |
| 165 | selectedIndex = moveInstallPromptSelection(selectedIndex, 'down', choices.length); |
| 166 | render(); |
| 167 | return; |
| 168 | } |
| 169 | if (key.name === 'return' || key.name === 'enter') { |
| 170 | const chosen = choices[selectedIndex]?.value ?? 'skip'; |
| 171 | finish(chosen); |
| 172 | return; |
| 173 | } |
| 174 | if (key.name === 'escape' || (key.ctrl === true && key.name === 'c')) { |
| 175 | finish('skip'); |
| 176 | } |
| 177 | }; |
| 178 | |
| 179 | emitKeypressEvents(input); |
| 180 | if (canSetRawMode) { |
nothing calls this directly
no test coverage detected