Skip to content

Instantly share code, notes, and snippets.

@bencooper222
Created September 19, 2018 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bencooper222/1fb26912dbbe9313db7ea45a41eed4f3 to your computer and use it in GitHub Desktop.
Save bencooper222/1fb26912dbbe9313db7ea45a41eed4f3 to your computer and use it in GitHub Desktop.
const swipes = [];
require('readline')
.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
})
.on('line', line => {
console.log('\007'); // beep beep
swipes.push(line.slice(1, line.search('=')));
});
process.on('SIGINT', () => {
swipes.forEach(swipe => console.log(`\n${swipe}`));
process.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment