npm.io
1.0.7 • Published 5 years ago

clikey

Licence
BSD-2-Clause
Version
1.0.7
Deps
0
Size
2 kB
Vulns
0
Weekly
0
Stars
2

clikey

Prompts for a single keypress in a node.js CLI app

Usage

#!/usr/bin/env node
const clikey = require('clikey');

(async () => {
  const answer = await clikey('Are you sure? [y/N]');
  // answer received when a single key is pressed

  if (answer.toLowerCase() === 'y') {
    return console.log('You said YES!!!');
  }

  console.log('You said NO');
})();
Install
$ npm install --save clikey
Test
$ npm install && npm test