diff --git a/.gitignore b/.gitignore index 075b1d4..fe33983 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ !*.in !*.md !*.nix +!*.nu diff --git a/run.nu b/run.nu new file mode 100755 index 0000000..17619a9 --- /dev/null +++ b/run.nu @@ -0,0 +1,17 @@ +#!/usr/bin/env nu + +# Run a specified AoC challenge. +def main [ + year_day_part_ext: string # The file to run. For example `2023/1-2.py` or `2023/1-2.nix`. +] { + match ($year_day_part_ext | path parse | get extension) { + "nix" => { + nix eval (".#" + ($year_day_part_ext | str replace ".nix" "")) + } + "py" => { + cd ($year_day_part_ext | path dirname) + python $year_day_part_ext + cd - + } + } +}