https://github.com/tj/co-prompt
sane terminal user-input for node.js using thunks / generators
https://github.com/tj/co-prompt
Last synced: 9 months ago
JSON representation
sane terminal user-input for node.js using thunks / generators
- Host: GitHub
- URL: https://github.com/tj/co-prompt
- Owner: tj
- Created: 2013-07-19T01:08:04.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-03-25T00:12:57.000Z (almost 10 years ago)
- Last Synced: 2025-03-27T09:11:28.520Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 109 KB
- Stars: 192
- Watchers: 10
- Forks: 19
- Open Issues: 10
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# co-prompt
Sane terminal user-input for nodejs that return thunks for [co](https://github.com/visionmedia/co).
## Installation
```
$ npm install co-prompt
```
## Examples
```js
var name = yield prompt('username: ');
var pass = yield password('password: ');
var desc = yield multiline('description: ');
var ok = yield confirm('are you sure? ');
```
## API
### prompt(msg)
Prompt for user input with `msg`.
### prompt.password(msg, [mask])
Prompt for password input with `msg` and optional `mask`
defaulting to "*".
### prompt.multiline(msg)
Prompt for multi-line input with `msg`.
### prompt.confirm(msg)
Prompt for confirmation with `msg`.
## License
MIT