1 | var inq = require('inquirer'),
|
2 | es = require('event-stream'),
|
3 | _ = require('lodash');
|
4 |
|
5 | module.exports = function (message, possibility, callback) {
|
6 | function _checkbox(file, cb) {
|
7 | var opt = {
|
8 | message: 'Are you sure?',
|
9 | name:'val',
|
10 | type: 'checkbox',
|
11 | default: false
|
12 | };
|
13 |
|
14 | opt.choices = possibility;
|
15 |
|
16 | inq.prompt([opt], function (answear) {
|
17 | if (answear.val.length) {
|
18 | callback(answear.val, file, cb);
|
19 | cb(null, file);
|
20 | }
|
21 | });
|
22 | }
|
23 | return es.map(_checkbox);
|
24 | }; |
\ | No newline at end of file |