hedgequantx 2.7.91 → 2.7.93
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/app.js +19 -13
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -163,20 +163,23 @@ const run = async () => {
|
|
|
163
163
|
try {
|
|
164
164
|
log.info('Starting HQX CLI');
|
|
165
165
|
|
|
166
|
-
// First launch - show banner then
|
|
166
|
+
// First launch - show banner then try restore session
|
|
167
167
|
await banner();
|
|
168
168
|
|
|
169
|
-
const spinner = ora({ text: 'LOADING
|
|
169
|
+
const spinner = ora({ text: 'LOADING...', color: 'yellow' }).start();
|
|
170
170
|
|
|
171
171
|
const restored = await connections.restoreFromStorage();
|
|
172
172
|
|
|
173
173
|
if (restored) {
|
|
174
174
|
currentService = connections.getAll()[0].service;
|
|
175
175
|
await refreshStats();
|
|
176
|
+
spinner.succeed('SESSION RESTORED');
|
|
177
|
+
} else {
|
|
178
|
+
spinner.stop(); // Stop spinner - no session to restore
|
|
176
179
|
}
|
|
177
180
|
|
|
178
181
|
// Store spinner globally so dashboardMenu can stop it before clear
|
|
179
|
-
global.__hqxSpinner =
|
|
182
|
+
global.__hqxSpinner = null;
|
|
180
183
|
|
|
181
184
|
// Main loop
|
|
182
185
|
while (true) {
|
|
@@ -196,9 +199,9 @@ const run = async () => {
|
|
|
196
199
|
|
|
197
200
|
// Find max name length for alignment
|
|
198
201
|
const maxNameLen = Math.max(...numbered.map(n => n.name.length));
|
|
199
|
-
const
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
+
const itemWidth = 4 + 1 + maxNameLen; // [##] + space + name
|
|
203
|
+
const gap = 3; // gap between columns
|
|
204
|
+
const totalContentWidth = (itemWidth * numCols) + (gap * (numCols - 1));
|
|
202
205
|
|
|
203
206
|
// New rectangle (banner is always closed)
|
|
204
207
|
console.log(chalk.cyan('╔' + '═'.repeat(innerWidth) + '╗'));
|
|
@@ -220,19 +223,22 @@ const run = async () => {
|
|
|
220
223
|
}
|
|
221
224
|
}
|
|
222
225
|
|
|
223
|
-
|
|
226
|
+
// Build line content
|
|
227
|
+
let content = '';
|
|
224
228
|
for (let i = 0; i < lineParts.length; i++) {
|
|
225
229
|
if (lineParts[i]) {
|
|
226
|
-
|
|
230
|
+
content += chalk.cyan(lineParts[i].num) + ' ' + chalk.white(lineParts[i].name);
|
|
227
231
|
} else {
|
|
228
|
-
|
|
232
|
+
content += ' '.repeat(itemWidth);
|
|
229
233
|
}
|
|
230
|
-
if (i < lineParts.length - 1)
|
|
234
|
+
if (i < lineParts.length - 1) content += ' '.repeat(gap);
|
|
231
235
|
}
|
|
232
236
|
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
237
|
+
// Center the content
|
|
238
|
+
const contentLen = content.replace(/\x1b\[[0-9;]*m/g, '').length;
|
|
239
|
+
const leftPad = Math.floor((innerWidth - contentLen) / 2);
|
|
240
|
+
const rightPad = innerWidth - contentLen - leftPad;
|
|
241
|
+
console.log(chalk.cyan('║') + ' '.repeat(leftPad) + content + ' '.repeat(rightPad) + chalk.cyan('║'));
|
|
236
242
|
}
|
|
237
243
|
|
|
238
244
|
console.log(chalk.cyan('╠' + '─'.repeat(innerWidth) + '╣'));
|