-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.ts
33 lines (27 loc) · 976 Bytes
/
run.ts
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
import getInput from "./src/ts/utils/getInput";
import {downloadInput} from "./di";
(async () => {
let day = new Date().getDate();
let year = new Date().getFullYear();
let testing = false;
if (process.argv[2] !== undefined) {
if (process.argv[2] === 't') {
testing = true;
} else if (process.argv[2] === 'd') {
await downloadInput(day, year);
} else {
day = parseInt(process.argv[2]);
if (process.argv[3] !== undefined) {
year = parseInt(process.argv[3]);
if (process.argv[4] === "t") {
testing = true;
} else if (process.argv[4] === 'd') {
await downloadInput(day, year);
}
}
}
}
const solution = require(`./src/year${year}/day${day}/solution-${day}.ts`);
const input = getInput(day, year, testing);
solution.solution(input, testing);
})();