-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
81 lines (66 loc) · 1.41 KB
/
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
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
package main
import (
"fmt"
"log"
"os"
"github.com/vincentharrius/aoc21/day1"
"github.com/vincentharrius/aoc21/day2"
"github.com/vincentharrius/aoc21/day3"
"github.com/vincentharrius/aoc21/day4"
"github.com/vincentharrius/aoc21/day5"
"github.com/vincentharrius/aoc21/day6"
"github.com/vincentharrius/aoc21/day7"
"github.com/vincentharrius/aoc21/day8"
)
func main() {
if len(os.Args) <= 1 {
fmt.Println("No args")
return
}
skipnext := false
for i, arg := range os.Args {
if skipnext {
skipnext = false
continue
}
switch arg {
case "-c":
createDayFolder(os.Args[i+1])
skipnext = true
case "1":
fmt.Println(day1.IncreasedMeasurements(1))
fmt.Println(day1.IncreasedMeasurements(3))
break
case "2":
fmt.Println(day2.Dive())
break
case "3":
fmt.Println(day3.CalculatePowerUsage())
fmt.Println(day3.VeryifyLifeSupportRating())
break
case "4":
fmt.Println(day4.ThatsABingo())
break
case "5":
fmt.Println(day5.HydrothermalVenture())
break
case "6":
fmt.Println(day6.LanternFish())
break
case "7":
fmt.Println(day7.TheTreacheryOfWhales())
break
case "8":
fmt.Println(day8.SevenSegmentSearch())
}
}
}
func createDayFolder(day string) {
foldername := "day" + day
if err := os.Mkdir(foldername, 0755); err != nil {
log.Fatal(err)
}
if _, err := os.Create(foldername + "/day" + day + ".go"); err != nil {
log.Fatal(err)
}
}