From 8e95641aa4e090244749d68411621f0f8c1ce676 Mon Sep 17 00:00:00 2001 From: Luna Komorebi Date: Wed, 20 Dec 2023 00:39:32 +0100 Subject: [PATCH] Rename files and add template for new day --- {day1 => day01}/example.txt | 0 {day1 => day01}/example2.txt | 0 {day1 => day01}/part1.go | 0 {day1 => day01}/part2.go | 0 {day2 => day02}/day2.go | 0 {day2 => day02}/example.txt | 0 day_template/day.go | 35 +++++++++++++++++++++++++++++++++++ new_day.sh | 22 ++++++++++++++++++++++ 8 files changed, 57 insertions(+) rename {day1 => day01}/example.txt (100%) rename {day1 => day01}/example2.txt (100%) rename {day1 => day01}/part1.go (100%) rename {day1 => day01}/part2.go (100%) rename {day2 => day02}/day2.go (100%) rename {day2 => day02}/example.txt (100%) create mode 100644 day_template/day.go create mode 100644 new_day.sh diff --git a/day1/example.txt b/day01/example.txt similarity index 100% rename from day1/example.txt rename to day01/example.txt diff --git a/day1/example2.txt b/day01/example2.txt similarity index 100% rename from day1/example2.txt rename to day01/example2.txt diff --git a/day1/part1.go b/day01/part1.go similarity index 100% rename from day1/part1.go rename to day01/part1.go diff --git a/day1/part2.go b/day01/part2.go similarity index 100% rename from day1/part2.go rename to day01/part2.go diff --git a/day2/day2.go b/day02/day2.go similarity index 100% rename from day2/day2.go rename to day02/day2.go diff --git a/day2/example.txt b/day02/example.txt similarity index 100% rename from day2/example.txt rename to day02/example.txt diff --git a/day_template/day.go b/day_template/day.go new file mode 100644 index 0000000..5bbfd25 --- /dev/null +++ b/day_template/day.go @@ -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) +} diff --git a/new_day.sh b/new_day.sh new file mode 100644 index 0000000..5729d32 --- /dev/null +++ b/new_day.sh @@ -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 + +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 +