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
- Host: GitHub
- URL: https://github.com/zewish/clikey
- Owner: zewish
- Created: 2017-08-07T08:09:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-03-30T08:08:27.000Z (about 5 years ago)
- Last Synced: 2025-10-29T05:59:42.826Z (8 months ago)
- Topics: cli, keypress, nodejs, prompt
- Language: JavaScript
- Size: 19.5 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```