aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rwxr-xr-xaoc17
2 files changed, 18 insertions, 2 deletions
diff --git a/README.md b/README.md
index f039909..68353ca 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,7 @@ Language: Haskell
## Running exercises
- cd day01
- ghc ../utils.hs main.hs && (cat input.txt | ./main)
+ ./aoc day01
## Author
diff --git a/aoc b/aoc
new file mode 100755
index 0000000..8e144fb
--- /dev/null
+++ b/aoc
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+DAY="${1}"
+if [ -z "${DAY}" ]; then
+ echo "usage: ${0} day01"
+ exit 1
+fi
+
+set -euo pipefail
+
+cd "${DAY}"
+if [ ! -f "input.txt" ]; then
+ echo "input.txt not found in ${DAY}"
+ exit 1
+fi
+
+ghc ../utils.hs main.hs && (cat input.txt | ./main)