Rename files and add template for new day
This commit is contained in:
parent
15c31708d1
commit
8e95641aa4
8 changed files with 57 additions and 0 deletions
35
day_template/day.go
Normal file
35
day_template/day.go
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func readInput() string {
|
||||||
|
stdin, err := io.ReadAll(os.Stdin)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
str := string(stdin)
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
|
||||||
|
func part1(lines []string) {
|
||||||
|
fmt.Println("Part 1 not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func part2(lines []string) {
|
||||||
|
fmt.Println("Part 2 not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
input := readInput()
|
||||||
|
lines := strings.Split(input, "\n")
|
||||||
|
fmt.Println("---PART 1---")
|
||||||
|
part1(lines)
|
||||||
|
fmt.Println("---PART 2---")
|
||||||
|
part2(lines)
|
||||||
|
}
|
22
new_day.sh
Normal file
22
new_day.sh
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Code borrowed from https://github.com/Daste745/aoc-2023/blob/master/new_day.sh
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
cat << EOF
|
||||||
|
Usage: new_day.sh <day_number>
|
||||||
|
|
||||||
|
Example: new_day.sh 08
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
day_number=$1
|
||||||
|
if [ -d "day$day_number" ]
|
||||||
|
then
|
||||||
|
echo "Day$day_number already exists"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ./day$day_number/
|
||||||
|
cp -v ./day_template/day.go ./day$day_number/day$day_number.go
|
||||||
|
|
Loading…
Add table
Reference in a new issue