···
runner = pkgs.writeShellScriptBin "aoc" ''
38
+
while [[ $# -gt 0 ]]; do
58
+
echo "Unknown option: $1"
59
+
echo "Usage: aoc [--day DAY] [--lang ts|nix] [--all] [--init]"
65
+
# If running with flags, skip interactive mode
66
+
if [ -n "$day_flag" ]; then
67
+
# Format day with leading zero
68
+
day=$(printf "%02d" $((10#$day_flag)))
70
+
# Determine which languages to run
74
+
if [ -z "$lang_flag" ] || [ "$lang_flag" = "both" ]; then
75
+
[ -f "ts/$day/index.ts" ] && run_ts=true
76
+
[ -f "nix/$day/solution.nix" ] && run_nix=true
77
+
elif [ "$lang_flag" = "ts" ] || [ "$lang_flag" = "typescript" ]; then
78
+
[ -f "ts/$day/index.ts" ] && run_ts=true
79
+
elif [ "$lang_flag" = "nix" ]; then
80
+
[ -f "nix/$day/solution.nix" ] && run_nix=true
82
+
echo "Unknown language: $lang_flag (use ts or nix)"
86
+
if [ "$run_ts" = false ] && [ "$run_nix" = false ]; then
87
+
echo "No solutions found for day $day"
91
+
${gum}/bin/gum style --border rounded --border-foreground 212 --padding "0 1" "Day $day"
94
+
if [ "$run_ts" = true ]; then
95
+
${gum}/bin/gum style --foreground 212 "TypeScript:"
96
+
(cd ts/$day && ${pkgs.bun}/bin/bun run index.ts)
100
+
if [ "$run_nix" = true ]; then
101
+
${gum}/bin/gum style --foreground 212 "Nix:"
102
+
result=$(${pkgs.nix}/bin/nix-instantiate --eval --strict --json nix/$day/solution.nix)
103
+
echo "$result" | ${pkgs.jq}/bin/jq -r 'to_entries | .[] | "\(.key): \(.value)"'
109
+
# If --all flag, run all solutions
110
+
if [ "$action_flag" = "all" ]; then
112
+
for dir in ts/* nix/*; do
113
+
if [ -d "$dir" ]; then
114
+
day=$(basename "$dir")
115
+
if [[ ! " ''${all_days[@]} " =~ " ''${day} " ]]; then
121
+
for daynum in $(printf '%s\n' "''${all_days[@]}" | sort); do
122
+
${gum}/bin/gum style --border rounded --border-foreground 212 --padding "0 1" "Day $daynum"
125
+
if [ -f "ts/$daynum/index.ts" ]; then
126
+
${gum}/bin/gum style --foreground 212 "TypeScript:"
127
+
(cd ts/$daynum && ${pkgs.bun}/bin/bun run index.ts)
131
+
if [ -f "nix/$daynum/solution.nix" ]; then
132
+
${gum}/bin/gum style --foreground 212 "Nix:"
133
+
result=$(${pkgs.nix}/bin/nix-instantiate --eval --strict --json nix/$daynum/solution.nix)
134
+
echo "$result" | ${pkgs.jq}/bin/jq -r 'to_entries | .[] | "\(.key): \(.value)"'
--border-foreground 212 \
···
"$(${gum}/bin/gum style --foreground 212 '🎄 Advent of Code 2025 🎄')"
41
-
action=$(${gum}/bin/gum choose "Run specific day" "Run all solutions" "Init new day" "Exit")
151
+
if [ "$action_flag" = "init" ]; then
152
+
action="Init new day"
154
+
action=$(${gum}/bin/gum choose "Run specific day" "Run all solutions" "Init new day" "Exit")