summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authormhsn <mail@mhsn.net>2024-12-01 12:01:00 +0000
committermhsn <mail@mhsn.net>2024-12-01 12:01:00 +0000
commit9015922392c9881ca62871692c3a6671243c1fe3 (patch)
tree3ced4980927b65675c07cfc0d8967feba85cf3b7 /init
parent0b1a6fc65a62a656bef6055027faf2f5e1f3235a (diff)
downloadaoc-9015922392c9881ca62871692c3a6671243c1fe3.tar.gz
aoc-9015922392c9881ca62871692c3a6671243c1fe3.zip
Add util scripts
Diffstat (limited to 'init')
-rwxr-xr-xinit33
1 files changed, 33 insertions, 0 deletions
diff --git a/init b/init
new file mode 100755
index 0000000..422d762
--- /dev/null
+++ b/init
@@ -0,0 +1,33 @@
+#!/usr/bin/env zsh
+
+year=$1
+day=$2
+
+script=$(readlink -f "$0")
+script_path=$(dirname "$script")
+
+aoc_path=$script_path/$1/$2
+
+mkdir --parents $aoc_path
+
+if [[ ! -d $aoc_path/data ]]; then
+ # Data directory
+ 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
+ mkdir --parents $aoc_path/python
+ cp "$script_path/template/main.py" "$aoc_path/python/main.py"
+fi
+
+# Rust
+if [[ ! -d $aoc_path/rust ]]; then
+ cargo new "$aoc_path/rust" --vcs none --name "aoc_$year-$day"
+ cp "$script_path/template/main.rs" "$aoc_path/rust/src/main.rs"
+fi