hedgequantx 1.8.2 → 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 +13 -15
package/package.json
CHANGED
package/src/utils/prompts.js
CHANGED
|
@@ -91,29 +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
|
+
|
|
99
|
+
const choices = options.map(opt => ({
|
|
100
|
+
name: opt.label,
|
|
101
|
+
value: opt.value
|
|
102
|
+
}));
|
|
103
|
+
|
|
98
104
|
const { value } = await inquirer.prompt([{
|
|
99
|
-
type: '
|
|
105
|
+
type: 'list',
|
|
100
106
|
name: 'value',
|
|
101
107
|
message,
|
|
102
|
-
|
|
108
|
+
choices,
|
|
109
|
+
prefix: '',
|
|
110
|
+
loop: false,
|
|
111
|
+
pageSize: 15
|
|
103
112
|
}]);
|
|
104
113
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// Find by value
|
|
108
|
-
for (const opt of options) {
|
|
109
|
-
if (String(opt.value).toLowerCase() === input) return opt.value;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Find by index (1-based)
|
|
113
|
-
const idx = parseInt(input) - 1;
|
|
114
|
-
if (idx >= 0 && idx < options.length) return options[idx].value;
|
|
115
|
-
|
|
116
|
-
return null;
|
|
114
|
+
return value;
|
|
117
115
|
};
|
|
118
116
|
|
|
119
117
|
module.exports = {
|