mirror of
https://github.com/RGBCube/AdventOfCode
synced 2025-07-26 03:27:44 +00:00
21 lines
534 B
Text
Executable file
21 lines
534 B
Text
Executable file
#!/usr/bin/env nu
|
|
|
|
def complete [] {
|
|
ls 2023 | get names | filter { not ($in str-endswith ".in") }
|
|
}
|
|
|
|
# Run a specified AoC solution.
|
|
def main [
|
|
year_day_part_ext: string@complete # 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 -
|
|
}
|
|
}
|
|
}
|