Package Exports
- prompt-promise
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prompt-promise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Sane CLI user-input (command prompt, confirm, multiline, password) as promises, it can be used with co@4
Install
npm install prompt-promise
Run examples
npm run-script with-co
npm run-script without-co
Usage
For more use-cases see examples
var co = require('co');
var prompt = require('prompt-promise');
prompt('username: ')
.then(function fulfilled(val) {
console.log('response:', val);
prompt.done();
})
.catch(function rejected(err) {
console.log('error:', err.stack);
prompt.finish();
});
// or with `co@4`
co(function * genPrompt() {
var username = yield prompt('username: ');
var password = yield prompt.password('password: ');
return yield [username, password];
})
.then(function fulfilled(array) {
console.log('response:', array);
prompt.end();
})
.catch(function rejected(err) {
console.log('error:', err.stack);
process.stdin.pause();
});
.end()
, .done()
, .finish()
are just aliases for process.stdin.pause();
its required, nah..
Author
Charlike Mike Reagent
License 
Copyright (c) 2014 Charlike Mike Reagent, contributors.
Copyright (c) 2014 TJ Holowaychuk, contributors.
Released under the MIT
license.
Powered and automated by readdirp + hogan.js, December 21, 2014