1
Fork 0
mirror of https://github.com/RGBCube/AdventOfCode synced 2025-07-25 19:17:44 +00:00

Add run script

This commit is contained in:
RGBCube 2023-12-01 23:51:14 +03:00
parent dfda2c002c
commit 5832784e82
No known key found for this signature in database
2 changed files with 18 additions and 0 deletions

1
.gitignore vendored
View file

@ -8,3 +8,4 @@
!*.in
!*.md
!*.nix
!*.nu

17
run.nu Executable file
View file

@ -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 -
}
}
}