Advent of Code solutions

breaking run from compile steps

+33 -22
+33 -22
Justfile
··· 9 default: p1 p2 10 11 [no-cd] 12 - p1 input="input": (do "p1" input) 13 14 [no-cd] 15 - p2 input="input": (do "p2" input) 16 17 [no-cd] 18 - do part input: 19 #!/usr/bin/env fish 20 set fn (fd -d 1 -t f {{part}}) 21 if test -n "$fn" -a -x "$fn" 22 time "./$fn" < {{input}} ··· 36 pushd {{part}} 37 time gleam run "$fn" < ../{{input}} 38 else if test -f {{part}}.erl 39 - erl -compile "$fn" 40 - and time erl -noshell -s {{part}} main -s init stop < {{input}} 41 - else if test -f {{part}}.swift 42 - swiftc "$fn" > /dev/null 43 - and time ./{{part}} < {{input}} 44 - else if test -f {{part}}.rs 45 - rustc "$fn" > /dev/null 46 - and time ./{{part}} < {{input}} 47 - else if test -f {{part}}.c 48 - gcc "$fn" -o {{part}} > /dev/null 49 - and time ./{{part}} < {{input}} 50 - else if test -f {{part}}.cpp 51 - g++ -std=c++2c "$fn" -o {{part}} > /dev/null 52 - and time ./{{part}} < {{input}} 53 - else if test -f {{part}}.hs 54 - ghc {{part}} -O -outputdir.{{part}} > /dev/null 55 - and time ./{{part}} < {{input}} 56 else if ls | rg "\.cabal\$" -q 57 - cabal build {{part}} > /dev/null 58 - and time cabal run {{part}} < {{input}} 59 else 60 echo "Current directory does not contain known solution configuration" 61 exit 1
··· 9 default: p1 p2 10 11 [no-cd] 12 + p1 input="input": (compile "p1") && (run "p1" input) 13 + 14 + [no-cd] 15 + p2 input="input": (compile "p2") && (run "p2" input) 16 17 [no-cd] 18 + compile part: 19 + #!/usr/bin/env fish 20 + if test -f {{part}}.erl 21 + erl -compile {{part}}.erl 22 + else if test -f {{part}}.swift 23 + swiftc {{part}}.swift > /dev/null 24 + else if test -f {{part}}.rs 25 + rustc {{part}}.rs > /dev/null 26 + else if test -f {{part}}.c 27 + gcc {{part}}.c -o {{part}} > /dev/null 28 + else if test -f {{part}}.cpp 29 + g++ -std=c++2c {{part}}.cpp -o {{part}} > /dev/null 30 + else if test -f {{part}}.hs 31 + ghc {{part}} -O -outputdir.{{part}} > /dev/null 32 + else if ls | rg "\.cabal\$" -q 33 + cabal build {{part}} > /dev/null 34 + else if test -f {{part}}.erl 35 + erl -compile "$fn" 36 + else if test -d {{part}} -a -f {{part}}/gleam.toml 37 + pushd {{part}} 38 + gleam build 39 + end 40 41 [no-cd] 42 + run part input="input": 43 #!/usr/bin/env fish 44 + if test -x {{part}} 45 + time ./{{part}} < {{input}} 46 + exit 0 47 + end 48 set fn (fd -d 1 -t f {{part}}) 49 if test -n "$fn" -a -x "$fn" 50 time "./$fn" < {{input}} ··· 64 pushd {{part}} 65 time gleam run "$fn" < ../{{input}} 66 else if test -f {{part}}.erl 67 + time erl -noshell -s {{part}} main -s init stop < {{input}} 68 else if ls | rg "\.cabal\$" -q 69 + time cabal run {{part}} < {{input}} 70 else 71 echo "Current directory does not contain known solution configuration" 72 exit 1