-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (27 loc) · 811 Bytes
/
main.go
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
package main
import (
"log"
"os"
"strconv"
c "github.com/PyMarcus/codes_download/constants"
s "github.com/PyMarcus/codes_download/service"
)
func main() {
log.Println(c.YELLOW + "Starting ...")
os.MkdirAll("data", os.ModePerm)
os.MkdirAll("json", os.ModePerm)
args := os.Args[1:]
if len(args) < 2{
log.Println(c.YELLOW + "Missing arguments! Use ./main.go [language] [true/false]" + c.RESET)
}
year, _ := strconv.Atoi(args[2])
if args[1] == "true"{
repository := s.NewRepository(args[0], true, year)
repository.StartDownloads()
}else if args[1] == "false"{
repository := s.NewRepository(args[0], false, year)
repository.StartDownloads()
}else{
log.Println(c.YELLOW + "Missing arguments! Use ./main.go [language] [true/false]" + c.RESET)
}
}