icoa-cli 2.9.1 → 2.9.3
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 +13 -3
- package/dist/repl.js +4 -5
- package/package.json +1 -1
package/dist/commands/exam.js
CHANGED
|
@@ -91,7 +91,7 @@ function printQuestion(q, answer) {
|
|
|
91
91
|
const isEliminated = eliminated.includes(key);
|
|
92
92
|
const selected = answer === key;
|
|
93
93
|
if (isEliminated) {
|
|
94
|
-
console.log(chalk.gray.strikethrough(` ${key}. ${q.options[key]}`));
|
|
94
|
+
console.log(chalk.gray.strikethrough(` ${key}. ${q.options[key]}`) + chalk.red(' (wrong)'));
|
|
95
95
|
}
|
|
96
96
|
else if (selected) {
|
|
97
97
|
console.log(chalk.green.bold(` ▸ ${key}. ${q.options[key]}`));
|
|
@@ -130,7 +130,6 @@ export function registerExamCommand(program) {
|
|
|
130
130
|
printInfo('No exams available.');
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
printHeader('Available Exams');
|
|
134
133
|
const rows = exams.map((e) => {
|
|
135
134
|
const statusColor = e.status === 'submitted' ? chalk.green
|
|
136
135
|
: e.status === 'in_progress' ? chalk.yellow
|
|
@@ -144,9 +143,20 @@ export function registerExamCommand(program) {
|
|
|
144
143
|
statusColor(e.status),
|
|
145
144
|
];
|
|
146
145
|
});
|
|
146
|
+
// Group by country
|
|
147
|
+
const countries = [...new Set(exams.map((e) => e.country))];
|
|
148
|
+
if (countries.length > 1) {
|
|
149
|
+
printHeader(`Available Exams (${countries.length} countries)`);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
printHeader('Available Exams');
|
|
153
|
+
}
|
|
147
154
|
printTable(['ID', 'Name', 'Country', 'Questions', 'Duration', 'Status'], rows);
|
|
148
155
|
console.log();
|
|
149
|
-
console.log(chalk.gray(' Start
|
|
156
|
+
console.log(chalk.gray(' Start: exam start <id>'));
|
|
157
|
+
if (countries.length > 1) {
|
|
158
|
+
console.log(chalk.gray(` Countries: ${countries.join(', ')}`));
|
|
159
|
+
}
|
|
150
160
|
}
|
|
151
161
|
catch (err) {
|
|
152
162
|
spinner.fail('Failed to load exams');
|
package/dist/repl.js
CHANGED
|
@@ -130,11 +130,10 @@ export async function startRepl(program, resumeMode) {
|
|
|
130
130
|
console.log(chalk.green(` Welcome back, ${config.userName}!`) + ' ' + modeLabel);
|
|
131
131
|
console.log(chalk.gray(` Connected to ${config.ctfdUrl}`));
|
|
132
132
|
console.log();
|
|
133
|
-
console.log(chalk.gray('
|
|
134
|
-
console.log(chalk.
|
|
135
|
-
console.log(chalk.white('
|
|
136
|
-
console.log(chalk.
|
|
137
|
-
console.log(chalk.gray(' ─────────────────────────────────'));
|
|
133
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────'));
|
|
134
|
+
console.log(chalk.bold.cyan(' demo') + chalk.gray(' Free practice exam'));
|
|
135
|
+
console.log(chalk.white(' exam list') + chalk.gray(' Your available exams'));
|
|
136
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────'));
|
|
138
137
|
console.log();
|
|
139
138
|
}
|
|
140
139
|
else {
|