-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.js
54 lines (50 loc) · 1.16 KB
/
cli.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const { argv, exit } = require('process')
const {
boulderwelt,
swm,
einstein,
dav,
heavensgate,
steinbock
} = require('./src/fetchers/index')
const swmMappings = require('./src/helpers/swm_mapping')
var allCases = []
const registerCase = (c) => {
allCases = [...allCases, c]
return c
}
const main = async () => {
switch (argv[2]) {
case registerCase('boulderwelt'):
await boulderwelt().then(console.log)
break
case registerCase('swm'):
await swm()
.then((data) =>
data.map(({ swmId, ...rest }) => ({
...swmMappings[swmId],
...rest
}))
)
.then(console.log)
break
case registerCase('einstein'):
await einstein().then(console.log)
break
case registerCase('dav'):
await dav().then(console.log)
break
case registerCase('heavensgate'):
await heavensgate().then(console.log)
break
case registerCase('steinbock'):
await steinbock().then(console.log)
break
default:
console.error(
`location ${argv[2]} is unknown, use one of ${JSON.stringify(allCases)}`
)
exit(1)
}
}
main()