hedgequantx 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/prompts.js +11 -20
package/package.json
CHANGED
package/src/utils/prompts.js
CHANGED
|
@@ -91,36 +91,27 @@ const numberInput = async (message, defaultVal = 1, min = 1, max = 1000) => {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* Select -
|
|
94
|
+
* Select - arrow keys navigation
|
|
95
95
|
*/
|
|
96
96
|
const selectOption = async (message, options) => {
|
|
97
97
|
prepareStdin();
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
console.log();
|
|
99
|
+
const choices = options.map(opt => ({
|
|
100
|
+
name: opt.label,
|
|
101
|
+
value: opt.value
|
|
102
|
+
}));
|
|
104
103
|
|
|
105
104
|
const { value } = await inquirer.prompt([{
|
|
106
|
-
type: '
|
|
105
|
+
type: 'list',
|
|
107
106
|
name: 'value',
|
|
108
107
|
message,
|
|
109
|
-
|
|
108
|
+
choices,
|
|
109
|
+
prefix: '',
|
|
110
|
+
loop: false,
|
|
111
|
+
pageSize: 15
|
|
110
112
|
}]);
|
|
111
113
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// Find by value
|
|
115
|
-
for (const opt of options) {
|
|
116
|
-
if (String(opt.value).toLowerCase() === input) return opt.value;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Find by index (1-based)
|
|
120
|
-
const idx = parseInt(input) - 1;
|
|
121
|
-
if (idx >= 0 && idx < options.length) return options[idx].value;
|
|
122
|
-
|
|
123
|
-
return null;
|
|
114
|
+
return value;
|
|
124
115
|
};
|
|
125
116
|
|
|
126
117
|
module.exports = {
|