icoa-cli 2.16.0 → 2.16.2
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 +45 -2
- package/package.json +1 -1
package/dist/commands/exam.js
CHANGED
|
@@ -106,8 +106,9 @@ function printQuestion(q, answer) {
|
|
|
106
106
|
console.log(chalk.yellow(` ${egg.emoji} ${egg.text}`));
|
|
107
107
|
}
|
|
108
108
|
console.log();
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
if (q.category)
|
|
110
|
+
console.log(chalk.cyan(` [${q.category}]`));
|
|
111
|
+
console.log(chalk.bold.white(` Q${q.number}. `) + chalk.white(q.text));
|
|
111
112
|
console.log();
|
|
112
113
|
for (const key of ['A', 'B', 'C', 'D']) {
|
|
113
114
|
const isEliminated = eliminated.includes(key);
|
|
@@ -123,6 +124,13 @@ function printQuestion(q, answer) {
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
console.log();
|
|
127
|
+
// Q2 tutorial hint
|
|
128
|
+
const isDemo = state?.session.examId === 'demo-free';
|
|
129
|
+
const q2Helps = help.perQ[2] || 0;
|
|
130
|
+
if (isDemo && q.number === 2 && q2Helps === 0) {
|
|
131
|
+
console.log(chalk.yellow.bold(' 👉 Try typing "help" to see what happens!'));
|
|
132
|
+
console.log();
|
|
133
|
+
}
|
|
126
134
|
// Full menu on every question
|
|
127
135
|
const remaining = help.max - help.used;
|
|
128
136
|
const helpLabel = remaining > 0 ? `remove a wrong option (${remaining}/${help.max})` : (help.max < 8 ? 'used up — type more help for +3' : `used up (${help.used}/${help.max})`);
|
|
@@ -527,6 +535,18 @@ export function registerExamCommand(program) {
|
|
|
527
535
|
printError('Choice must be A, B, C, or D.');
|
|
528
536
|
return;
|
|
529
537
|
}
|
|
538
|
+
// Q2 tutorial: must use help first before answering
|
|
539
|
+
if (state.session.examId === 'demo-free' && num === 2) {
|
|
540
|
+
const helpState = getHelpState(state);
|
|
541
|
+
const q2Helps = helpState.perQ[2] || 0;
|
|
542
|
+
if (q2Helps === 0) {
|
|
543
|
+
console.log();
|
|
544
|
+
console.log(chalk.yellow(' 💡 Try typing ') + chalk.bold.yellow('help') + chalk.yellow(' first to see what it does!'));
|
|
545
|
+
console.log(chalk.gray(' This question requires you to use help before answering.'));
|
|
546
|
+
console.log();
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
530
550
|
state.answers[num] = c;
|
|
531
551
|
state._lastQ = num;
|
|
532
552
|
saveExamState(state);
|
|
@@ -848,6 +868,29 @@ export function registerExamCommand(program) {
|
|
|
848
868
|
console.log();
|
|
849
869
|
printHowToPlay();
|
|
850
870
|
console.log();
|
|
871
|
+
// Ask language preference first
|
|
872
|
+
const { getConfig: gc } = await import('../lib/config.js');
|
|
873
|
+
const currentLang = gc().language || 'en';
|
|
874
|
+
const langConfirm = await confirm({
|
|
875
|
+
message: chalk.white(`Questions will be in English. OK?`),
|
|
876
|
+
default: true,
|
|
877
|
+
theme: { prefix: '', style: { message: (t) => t, defaultAnswer: (t) => chalk.green(t) } },
|
|
878
|
+
});
|
|
879
|
+
if (!langConfirm) {
|
|
880
|
+
console.log();
|
|
881
|
+
console.log(chalk.white(' Switch language first, then type ') + chalk.bold.cyan('demo') + chalk.white(' again:'));
|
|
882
|
+
console.log();
|
|
883
|
+
console.log(chalk.yellow(' lang es') + chalk.gray(' Español'));
|
|
884
|
+
console.log(chalk.yellow(' lang zh') + chalk.gray(' 中文'));
|
|
885
|
+
console.log(chalk.yellow(' lang ko') + chalk.gray(' 한국어'));
|
|
886
|
+
console.log(chalk.yellow(' lang ja') + chalk.gray(' 日本語'));
|
|
887
|
+
console.log(chalk.yellow(' lang fr') + chalk.gray(' Français'));
|
|
888
|
+
console.log(chalk.yellow(' lang ar') + chalk.gray(' العربية'));
|
|
889
|
+
console.log(chalk.yellow(' lang pt') + chalk.gray(' Português'));
|
|
890
|
+
console.log(chalk.yellow(' lang') + chalk.gray(' View all 15 languages'));
|
|
891
|
+
console.log();
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
851
894
|
const proceed = await confirm({
|
|
852
895
|
message: chalk.white('Start demo exam now?'),
|
|
853
896
|
default: true,
|