@daliovic/cc-statusline 1.3.0 → 1.3.1
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/dist/wizard.js +17 -7
- package/package.json +1 -1
package/dist/wizard.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { select, checkbox, input, confirm } from "@inquirer/prompts";
|
|
2
2
|
import { DEFAULT_CONFIG, loadConfig, saveConfig, CONFIG_PATH, PRAYER_METHODS } from "./config.js";
|
|
3
|
+
// Clear screen
|
|
4
|
+
function clearScreen() {
|
|
5
|
+
process.stdout.write("\x1b[2J\x1b[H");
|
|
6
|
+
}
|
|
3
7
|
// ANSI color helper
|
|
4
8
|
function colorize(code, text) {
|
|
5
9
|
return `\x1b[38;5;${code}m${text}\x1b[0m`;
|
|
@@ -275,11 +279,15 @@ async function settingsMenu(config) {
|
|
|
275
279
|
throw e;
|
|
276
280
|
}
|
|
277
281
|
}
|
|
282
|
+
function showHeader(config) {
|
|
283
|
+
clearScreen();
|
|
284
|
+
console.log("\x1b[1mcc-statusline Configuration\x1b[0m");
|
|
285
|
+
console.log("\x1b[2mCtrl+C to go back/exit\x1b[0m");
|
|
286
|
+
showPreview(config);
|
|
287
|
+
}
|
|
278
288
|
export async function runWizard() {
|
|
279
|
-
console.log("\n\x1b[1mcc-statusline Configuration\x1b[0m");
|
|
280
|
-
console.log("\x1b[2mCtrl+C to go back/exit\x1b[0m\n");
|
|
281
289
|
const config = loadConfig();
|
|
282
|
-
|
|
290
|
+
showHeader(config);
|
|
283
291
|
try {
|
|
284
292
|
while (true) {
|
|
285
293
|
const autosaveLabel = config.wizard.autosave ? "\x1b[32m●\x1b[0m" : "\x1b[2m○\x1b[0m";
|
|
@@ -299,20 +307,23 @@ export async function runWizard() {
|
|
|
299
307
|
switch (choice) {
|
|
300
308
|
case "visibility":
|
|
301
309
|
await visibilityMenu(config);
|
|
302
|
-
|
|
310
|
+
showHeader(config);
|
|
303
311
|
break;
|
|
304
312
|
case "colors":
|
|
305
313
|
await colorsMenu(config);
|
|
306
|
-
|
|
314
|
+
showHeader(config);
|
|
307
315
|
break;
|
|
308
316
|
case "thresholds":
|
|
309
317
|
await thresholdsMenu(config);
|
|
318
|
+
showHeader(config);
|
|
310
319
|
break;
|
|
311
320
|
case "prayer":
|
|
312
321
|
await prayerMenu(config);
|
|
322
|
+
showHeader(config);
|
|
313
323
|
break;
|
|
314
324
|
case "settings":
|
|
315
325
|
await settingsMenu(config);
|
|
326
|
+
showHeader(config);
|
|
316
327
|
break;
|
|
317
328
|
case "reset":
|
|
318
329
|
const confirmReset = await confirm({
|
|
@@ -321,10 +332,9 @@ export async function runWizard() {
|
|
|
321
332
|
});
|
|
322
333
|
if (confirmReset) {
|
|
323
334
|
Object.assign(config, JSON.parse(JSON.stringify(DEFAULT_CONFIG)));
|
|
324
|
-
console.log(" Reset to defaults.\n");
|
|
325
335
|
autoSave(config);
|
|
326
|
-
showPreview(config);
|
|
327
336
|
}
|
|
337
|
+
showHeader(config);
|
|
328
338
|
break;
|
|
329
339
|
case "save":
|
|
330
340
|
saveConfig(config);
|