An open API service indexing awesome lists of open source software.

https://github.com/zewish/clikey

Prompts for a single keypress in a node.js CLI app
https://github.com/zewish/clikey

cli keypress nodejs prompt

Last synced: 26 days ago
JSON representation

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

Awesome Lists containing this project

README

          

## clikey

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

#### Usage
```javascript
#!/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
```bash
$ npm install --save clikey
```

#### Test
```bash
$ npm install && npm test
```