(data: Buffer, { name, sequence }: Key)
| 50 | } |
| 51 | |
| 52 | const clear = (data: Buffer, { name, sequence }: Key) => { |
| 53 | const str = String(data); |
| 54 | if (isActionKey([str, name, sequence], 'cancel')) { |
| 55 | if (hideCursor) output.write(cursor.show); |
| 56 | process.exit(0); |
| 57 | return; |
| 58 | } |
| 59 | if (!overwrite) return; |
| 60 | const dx = name === 'return' ? 0 : -1; |
| 61 | const dy = name === 'return' ? -1 : 0; |
| 62 | |
| 63 | readline.moveCursor(output, dx, dy, () => { |
| 64 | readline.clearLine(output, 1, () => { |
| 65 | input.once('keypress', clear); |
| 66 | }); |
| 67 | }); |
| 68 | }; |
| 69 | if (hideCursor) output.write(cursor.hide); |
| 70 | input.once('keypress', clear); |
| 71 |
nothing calls this directly
no test coverage detected