1
Fork 0
mirror of https://github.com/RGBCube/AdventOfCode synced 2026-01-14 17:21:05 +00:00
AdventOfCode/run.nu
2023-12-02 17:52:42 +03:00

17 lines
440 B
Text
Executable file

#!/usr/bin/env nu
# Run a specified AoC solution.
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 | path basename)
cd -
}
}
}