summary refs log tree commit diff
path: root/keys.js
blob: 3884908aacd8ac2187bcbe153a6311f085674784 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// util for figuring out key stuff
// run this, press a key, and it'll give you the json :+1:
import readline from 'node:readline';

readline.emitKeypressEvents(process.stdin);

if (process.stdin.isTTY) process.stdin.setRawMode(true);

process.stdin.on('keypress', (chunk, key) => {
    console.log(JSON.stringify(key))
    process.exit();
});