-
Notifications
You must be signed in to change notification settings - Fork 8
/
available-options.js
executable file
路58 lines (48 loc) 路 1.55 KB
/
available-options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict';
//polyfills
const process = require('suman-browser-polyfills/modules/process');
const global = require('suman-browser-polyfills/modules/global');
//core
const assert = require('assert');
const util = require('util');
const path = require('path');
const fs = require('fs');
//npm
const colors = require('colors/safe');
const inquirer = require('suman-inquirer');
//project
const _suman = global.__suman = (global.__suman || {});
const rejectionHandler = require('../interactive-rejection-handler');
/////////////////////////////////////////////////////////////////////
module.exports = function getAvailableOptions (opts, backspaceCB) {
_interactiveDebug('opts in OPTIONS TO USE => ', opts);
const optionsToUse = opts.optionsToUse;
return inquirer.prompt([
{
type: 'checkbox',
message: 'Select any command line options (use spacebar)',
name: 'command-line-options',
choices: optionsToUse,
when: function () {
console.log('\n\n ---------------------------------------- \n\n');
_suman.backspacing = false;
return true;
},
onLeftKey: function () {
_suman.onBackspace(backspaceCB);
},
filter: function (vals) {
return vals;
},
// validate: function (answer) {
// console.log('\n\n aaaaa => ', answer,'\n\n\n\n');
// if (answer.length < 1) {
// return 'You must choose at least one topping.';
// }
// return true;
// }
}
]).then(function (answers) {
return Object.assign(opts, answers);
})
};