aoc2024/.scaffold/aoc/hooks/post_scaffold.sh

18 lines
618 B
Bash
Raw Normal View History

#!/usr/bin/env bash
cd "{{ .Project }}" || exit 1
go mod init github.com/onyx-and-iris/aoc{{ .Scaffold.year }}/"{{ .Project }}"
go mod tidy
# shellcheck disable=SC2001
day=$(echo "{{ .Project }}" | sed 's/^day-0*//')
mkdir -p testdata
curl "https://adventofcode.com/{{ .Scaffold.year }}/day/$day/input" -H "Cookie: session=$AOC_SESSION" > testdata/input.txt
mkdir -p cmd/cli/testdata && ln testdata/input.txt cmd/cli/testdata/input.txt
mkdir -p internal/one/testdata && ln testdata/input.txt internal/one/testdata/input.txt
mkdir -p internal/two/testdata && ln testdata/input.txt internal/two/testdata/input.txt