blob: 2dd51ada911c764f1c1c168e19f781cea9eaffe8 (
plain)
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
|
#!/usr/bin/env sh
usage="usage: init <year> <day>"
year=${1?$usage}
day=${2?$usage}
# get directory of this script
script=$(readlink -f "$0")
script_path=$(dirname "$script")
aoc_path=$script_path/$year/$day
mkdir --parents $aoc_path
# Data directory
if [ ! -d $aoc_path/data ]; then
mkdir --parents $aoc_path/data
for f in "test" "aoc"; do
touch "$aoc_path/puzzle.txt"
touch "$aoc_path/data/$f.txt"
echo "silver: ???\ngold: ???" >"$aoc_path/data/$f.ans"
done
fi
# Python
if [ ! -d $aoc_path/python ]; then
uv init \
--vcs none \
--name "aoc_$year-$day" \
--no-pin-python \
--no-readme \
--description "advent of code $year-$day" \
"$aoc_path/python"
cp "$script_path/template/main.py" "$aoc_path/python/main.py"
echo "*" >"$aoc_path/python/.gitignore"
fi
# Rust
if [ ! -d $aoc_path/rust ]; then
cargo new \
--vcs none \
--name "aoc_$year-$day" \
"$aoc_path/rust"
cp "$script_path/template/main.rs" "$aoc_path/rust/src/main.rs"
echo "*" >"$aoc_path/rust/.gitignore"
fi
|