-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
53 lines (41 loc) · 1.67 KB
/
index.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env node
import gcg from 'commander';
import { codeforcesInit } from './src/codeforcesInit';
import { Initializer } from './src/initializer';
import { Validator } from './src/validate';
gcg.version('2.1.1', '-v, --version')
// .option('--overwrite', 'overwrite existing files')
gcg
.command('init <task>')
.description('initialize task')
.option('-o, --overwrite', 'overwrite existing files')
.option('-i, --input-only', 'only create .in tests, skip .out')
.option('-s, --silent', 'run silenty (no logging)')
.action((task, cmd) => {
const interactive = new Initializer(cmd, task);
interactive.start();
});
gcg
.command('run <task>')
.description('run task on it\'s tests. if no custom folder or test are specified, it runs on all tests in \'tests\' directory that start with <task> and on all tests in \'tests\\<task>\' directory.')
.option('--no-compile', 'disable compiling before running on tests')
.option('-f, --folder <folder>', 'set test folder path. defaults to \'tests\\<task>\'')
.option('-t, --test <testname>', 'run on chosen test only')
.option('-std', 'c++ standard for compiler. Defaults to c++17', 'c++17')
.action((task, cmd) => {
const validator = new Validator(cmd, task);
validator.start();
});
gcg
.command('cf <id>')
.description('prepare folder for Codeforces\'s contest with specified id')
.action(codeforcesInit);
gcg
.command('add')
gcg
.on('command:*', function () {
console.error('Invalid command: %s\nSee --help for a list of available commands.', gcg.args.join(' '));
process.exit(1);
});
gcg
.parse(process.argv);