-
Notifications
You must be signed in to change notification settings - Fork 0
/
addDay.sh
executable file
·98 lines (66 loc) · 1.43 KB
/
addDay.sh
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
#!/bin/bash
max=$(find . -type d | grep -E 'day[0-9]+' | cut -c6- | sort -r | head -n 1)
next=$(printf 'day%d' "$((max + 1))")
mkdir -p "$next"
touch "$next"/input.txt
touch "$next"/example.txt
touch "$next"/readme.md
cat > "$next"/day.go << EOM
// Package $next implements the solution to Day $((max+1)) of the Advent of Code 2022.
package $next
type (
// Day is the implementation of Day $((max+1)).
Day struct{
InputFile string
}
)
// New returns a new instance of Day.
func New() *Day {
return &Day{}
}
// Number returns the day number.
//
//nolint:gomnd // This is the day number used by the advent package to print the day number.
func (d *Day) Number() int {
return $((max + 1))
}
EOM
cat > "$next"/setup.go << EOM
package $next
// Setup sets up any required data for the days puzzle.
func (d *Day) Setup() error {
return nil
}
EOM
cat > "$next"/part1.go << EOM
package $next
// Part1 is the solution to part 1 of the day's puzzle.
func (d *Day) Part1() (string, error) {
return "", nil
}
EOM
cat > "$next"/part1_test.go << EOM
package ${next}_test
import (
"testing"
)
func TestPart1(t *testing.T) {
t.Parallel()
}
EOM
cat > "$next"/part2.go << EOM
package $next
// Part2 is the solution to part 2 of the day's puzzle.
func (d *Day) Part2() (string, error) {
return "", nil
}
EOM
cat > "$next"/part2_test.go << EOM
package ${next}_test
import (
"testing"
)
func TestPart2(t *testing.T) {
t.Parallel()
}
EOM