prompt-promise

Sane CLI user-input (command prompt, confirm, multiline, password, select/choose) as promises, it can be used with or without co@4

MIT License

Downloads
13.3K
Stars
12
Committers
3

npm mit license build status coverage status deps status

Sane CLI user-input (command prompt, confirm, multiline, password) as promises, it can be used with co@4

Install

npm i --save prompt-promise

Run examples

npm run with-co
npm run without-co

Usage

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);
})

Author

Charlike Mike Reagent

License MIT license

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

Package Rankings
Top 3.46% on Npmjs.org
Badges
Extracted from project README
npm mit license build status coverage status deps status MIT license
Related Projects