UNPKG

grading

Version:

Grading of student submissions, in particular programming tests.

26 lines (18 loc) 780 B
import { OptionValues } from "commander"; import { error, log, verbosity } from "./cliUtil"; import { folderExists, rmDir } from "../fsUtil"; export async function cmdClean(options: OptionValues) { verbosity(options); try { const workingDir = options.workingDir; const reportsDir = options.reportsDir; const npmCacheDir = options.npmCacheDir; if (await folderExists(workingDir, 'workingDir')) await rmDir(workingDir); if (await folderExists(npmCacheDir, 'npmCacheDir')) await rmDir(npmCacheDir); if (options.full && await folderExists(reportsDir, 'reportsDir')) await rmDir(reportsDir); } catch (err) { error(`${SEP}\nError: ${err}`); program.error(String(err)); } log(`${SEP}\nDone.`); }