icoa-cli 2.16.0 → 2.16.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/commands/exam.js +22 -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);
|