-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.js
More file actions
executable file
·111 lines (103 loc) · 4.08 KB
/
commands.js
File metadata and controls
executable file
·111 lines (103 loc) · 4.08 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env node
const program = require('commander')
const { prompt} = require('inquirer')
const saveHandle = require('./util').saveHandle
const initialScrape = require('./lib/initial_scraper')
const problemScraper = require('./lib/problem_scraper')
const userHandle = {
type: 'input',
name: 'handle',
message: 'user handle'
}
program
.version('1.0.0')
.description('A Cli tool for Code-drill website')
program
.command('sethandle <userHandle>')
.alias('h')
.option('-c, --codechef', 'For codechef account')
.option('-s, --spoj','For SPOJ account')
.option('-f, --codeforces','for codeforces account')
.description('Takes the handle from user for further queries')
.action( (userHandle, cmd) => {
if (cmd.codechef) {
saveHandle(userHandle,'cc')
initialScrape(userHandle,'cc')
}
else if (cmd.codeforces) {
saveHandle(userHandle,'cf')
initialScrape(userHandle,'cf')
}
else if (cmd.spoj) {
saveHandle(userHandle,'sp')
initialScrape(userHandle,'sp')
}
else console.error('Missing options! See handle --help')
})
program
.command('predict')
.alias('get')
.description('Predicts the problem')
.option('--warmup','Warmup')
.option('--daily','Daily_Practice')
.option('-e, --easy','Easy')
.option('-m, --medium','Medium')
.option('-h, --hard','Hard')
.option('-dp, --dynamic','Dynamic_Programming')
.option('-g, --greedy',"Greedy")
.option('-i, --implementation',"Implementation")
.option('--icpc',"ICPC")
.option('--adhoc','ADHOC')
.option('-m, --minicontest','Mini_Contest')
.option('--st', 'Strong_Topics')
.option('--bs', 'Binary_search')
.option('--bf', 'Brute_Force')
.option('--ds','Data_Structures')
.option('--dnc', 'Divide___Conquer')
.option('--bm', 'Bitmasks')
.option('--fft', 'FFT')
.option('--combinatorics', 'Combinatorics')
.option('--fnm', 'Flows___Matching')
.option('--games', 'Games')
.option('--geometry', 'Geometry')
.option('--gnt', 'Graphs___Trees')
.option('--hash', 'Hashing')
.option('--math', 'Math')
.option('--mat', 'Matrices')
.option('--nt', 'Number_Theory')
.option('--probability', 'Probabilities')
.option('--str', 'String')
.option('--random', 'Random')
.action( cmd => {
if (cmd.warmup) problemScraper('Warmup')
else if (cmd.daily) problemScraper('Daily_Practice')
else if (cmd.easy) problemScraper('Easy')
else if (cmd.medium) problemScraper('Medium')
else if (cmd.hard) problemScraper('Hard')
else if (cmd.dynamic) problemScraper('Dynamic_Programming')
else if (cmd.greedy) problemScraper('Greedy')
else if (cmd.implementation) problemScraper('Implementation')
else if (cmd.icpc) problemScraper('ICPC')
else if (cmd.adhoc) problemScraper('ADHOC')
else if(cmd.minicontest) problemScraper('Mini_Contest')
else if (cmd.st) problemScraper('Strong_Topics')
else if (cmd.bs) problemScraper('Binary_search')
else if (cmd.bf) problemScraper('Brute_Force')
else if (cmd.ds) problemScraper('Data_Structures')
else if (cmd.dnc) problemScraper('Divide___Conquer')
else if (cmd.bm) problemScraper('Bitmasks')
else if (cmd.fft) problemScraper('FFT')
else if (cmd.combinatorics) problemScraper('Combinatorics')
else if (cmd.fnm) problemScraper('Flows___Matching')
else if (cmd.games) problemScraper('Games')
else if (cmd.geometry) problemScraper('Geometry')
else if (cmd.gnt) problemScraper('Graphs___Trees')
else if (cmd.hash) problemScraper('Hashing')
else if (cmd.math) problemScraper('Math')
else if (cmd.mat) problemScraper('Matrices')
else if (cmd.nt) problemScraper('Number_Theory')
else if (cmd.probability) problemScraper('Probabilities')
else if (cmd.str) problemScraper('Strings')
else if (cmd.random) problemScraper('Random')
})
program.parse(process.argv)