icoa-cli 2.15.4 → 2.15.6
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/commands/exam.js +3 -1
- package/dist/commands/lang.js +19 -3
- package/package.json +1 -1
package/dist/commands/exam.js
CHANGED
|
@@ -521,9 +521,11 @@ export function registerExamCommand(program) {
|
|
|
521
521
|
const answered = Object.keys(state.answers).length;
|
|
522
522
|
const total = state.session.questionCount;
|
|
523
523
|
printSuccess(`Q${num}: ${c} ✓ (${answered}/${total} answered)`);
|
|
524
|
-
// Auto-show next question
|
|
524
|
+
// Auto-show next question and update _lastQ
|
|
525
525
|
if (num < state.questions.length) {
|
|
526
526
|
const nextQ = state.questions[num]; // 0-indexed: questions[num] = question num+1
|
|
527
|
+
state._lastQ = nextQ.number;
|
|
528
|
+
saveExamState(state);
|
|
527
529
|
printQuestion(nextQ, state.answers[nextQ.number]);
|
|
528
530
|
}
|
|
529
531
|
else if (answered === total) {
|
package/dist/commands/lang.js
CHANGED
|
@@ -25,7 +25,7 @@ export function registerLangCommand(program) {
|
|
|
25
25
|
program
|
|
26
26
|
.command('lang [code]')
|
|
27
27
|
.description('Switch display language')
|
|
28
|
-
.action((code) => {
|
|
28
|
+
.action(async (code) => {
|
|
29
29
|
logCommand(`lang ${code || ''}`);
|
|
30
30
|
if (!code) {
|
|
31
31
|
const config = getConfig();
|
|
@@ -50,9 +50,25 @@ export function registerLangCommand(program) {
|
|
|
50
50
|
}
|
|
51
51
|
saveConfig({ language: code });
|
|
52
52
|
printSuccess(`Language set to: ${LANG_NAMES[code] || code}`);
|
|
53
|
-
// If exam in progress,
|
|
53
|
+
// If demo exam in progress, reload questions in new language
|
|
54
54
|
const state = getExamState();
|
|
55
|
-
if (state) {
|
|
55
|
+
if (state && state.session.examId === 'demo-free') {
|
|
56
|
+
try {
|
|
57
|
+
const { getLocalizedDemoQuestions, getLocalizedDemoSession } = await import('../lib/demo-exam.js');
|
|
58
|
+
state.questions = getLocalizedDemoQuestions();
|
|
59
|
+
state.session.examName = getLocalizedDemoSession().examName;
|
|
60
|
+
const { saveExamState } = await import('../lib/exam-state.js');
|
|
61
|
+
saveExamState(state);
|
|
62
|
+
const currentQ = state._lastQ || 1;
|
|
63
|
+
console.log();
|
|
64
|
+
console.log(chalk.green(` Demo questions reloaded in ${LANG_NAMES[code] || code}.`));
|
|
65
|
+
console.log(chalk.white(` Resuming: exam q ${currentQ}`));
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
console.log(chalk.gray(' Language changed. Resume with: exam q 1'));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else if (state) {
|
|
56
72
|
const currentQ = state._lastQ || 1;
|
|
57
73
|
console.log();
|
|
58
74
|
console.log(chalk.gray(` Exam in progress — resuming Q${currentQ}:`));
|