Sane CLI user-input (command prompt, confirm, multiline, password) as promises, it can be used with co@4
npm i --save prompt-promise
npm run with-co
npm run without-co
For more use-cases see examples
var co = require('co');
var prompt = require('prompt-promise');
var res = [];
prompt('username: ')
.then(function username(val) {
res.push(val);
return prompt.password('password: ');
})
.then(function pasword(val) {
res.push(val);
console.log(res);
})
// 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);
})
Charlike Mike Reagent
Copyright (c) 2014-2015 Charlike Mike Reagent, contributors.
Copyright (c) 2014 TJ Holowaychuk, contributors.
Released under the MIT
license.
Powered and automated by kdf, January 31, 2015