-
Notifications
You must be signed in to change notification settings - Fork 10
/
eval.js
33 lines (29 loc) · 924 Bytes
/
eval.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const evalInput = require('../cli/input/eval');
const evalOutput = require('../cli/output/eval');
const evalModel = require('../model/eval');
const commandValidator = require('../utils/command-validator');
const onEvalResult = (evalResult) => {
evalOutput.sendOutput(evalResult);
};
const onEval = async (args, options, logger) => {
if (!commandValidator.validateSession()) {
return;
}
const evalOptions = await evalInput.getInput(args, options);
evalOutput.sendOutput({
name: 'eval_started',
});
evalModel.evaluate(evalOptions, onEvalResult);
};
const addTo = (program) => {
program
.command('eval', 'Submit to AutolabJS for evaluation')
.option('-l <lab>', 'Lab of submission')
.option('-i <id>', 'Student ID')
.option('--lang <lang>', 'Language of submission')
.option('-h <commit_hash>', 'Commit hash of submission')
.action(onEval);
};
module.exports = {
addTo,
};