From 4959d7df0195657bd787b60dedf8b0935f9733e6 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Fri, 1 Dec 2023 18:46:40 -0700 Subject: 2022 day 10 --- aoc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'aoc') diff --git a/aoc b/aoc index 51e6da8..f4c56a0 100755 --- a/aoc +++ b/aoc @@ -22,7 +22,7 @@ exec_test() { exec_part() { local logfile="logs/out_$1.txt" bun run "part_$1.ts" | tee $logfile - echo $(cat $logfile | tail -n 1) + cat $logfile } get_aoc_problem_path() { @@ -62,7 +62,7 @@ get_aoc_cookie() { echo "Please copy your Advent of Code cookie to the clipboard, then press Enter..." read -r - echo "$(pastecmd)" > "$AOCCOOKIE" + echo $($pastecmd) > "$AOCCOOKIE" echo "Cookie saved to $AOCCOOKIE" fi echo $(cat $AOCCOOKIE | tail -n 1) @@ -79,6 +79,7 @@ aoc() { echo "+ aoc init : initialize 'template/' to problem solution and" echo " pull input to '$AOCINPUT' (today by default)" echo "+ aoc test : run 'exec_test' in aoc problem (today by default)" + echo "+ aoc exec <1 | 2> : get the output of an aoc problem without submission" echo "+ aoc submit <1 | 2> : submit part one or part two to aoc problem (today by default)" fi @@ -123,6 +124,18 @@ aoc() { exec_test fi + if [[ $1 == "exec" ]]; then + if [[ 4 == $argc ]]; then + year=$3 + day=$4 + curr=$(get_aoc_problem_path $year $day) + fi + cd $curr + + local level=$2 + exec_part $level + fi + if [[ $1 == "submit" ]]; then if [[ 4 == $argc ]]; then year=$3 -- cgit v1.2.3-70-g09d2