···
runner = pkgs.writeShellScriptBin "aoc" ''
+
while [[ $# -gt 0 ]]; do
+
echo "Unknown option: $1"
+
echo "Usage: aoc [--day DAY] [--lang ts|nix] [--all] [--init]"
+
# If running with flags, skip interactive mode
+
if [ -n "$day_flag" ]; then
+
# Format day with leading zero
+
day=$(printf "%02d" $((10#$day_flag)))
+
# Determine which languages to run
+
if [ -z "$lang_flag" ] || [ "$lang_flag" = "both" ]; then
+
[ -f "ts/$day/index.ts" ] && run_ts=true
+
[ -f "nix/$day/solution.nix" ] && run_nix=true
+
elif [ "$lang_flag" = "ts" ] || [ "$lang_flag" = "typescript" ]; then
+
[ -f "ts/$day/index.ts" ] && run_ts=true
+
elif [ "$lang_flag" = "nix" ]; then
+
[ -f "nix/$day/solution.nix" ] && run_nix=true
+
echo "Unknown language: $lang_flag (use ts or nix)"
+
if [ "$run_ts" = false ] && [ "$run_nix" = false ]; then
+
echo "No solutions found for day $day"
+
${gum}/bin/gum style --border rounded --border-foreground 212 --padding "0 1" "Day $day"
+
if [ "$run_ts" = true ]; then
+
${gum}/bin/gum style --foreground 212 "TypeScript:"
+
(cd ts/$day && ${pkgs.bun}/bin/bun run index.ts)
+
if [ "$run_nix" = true ]; then
+
${gum}/bin/gum style --foreground 212 "Nix:"
+
result=$(${pkgs.nix}/bin/nix-instantiate --eval --strict --json nix/$day/solution.nix)
+
echo "$result" | ${pkgs.jq}/bin/jq -r 'to_entries | .[] | "\(.key): \(.value)"'
+
# If --all flag, run all solutions
+
if [ "$action_flag" = "all" ]; then
+
for dir in ts/* nix/*; do
+
if [[ ! " ''${all_days[@]} " =~ " ''${day} " ]]; then
+
for daynum in $(printf '%s\n' "''${all_days[@]}" | sort); do
+
${gum}/bin/gum style --border rounded --border-foreground 212 --padding "0 1" "Day $daynum"
+
if [ -f "ts/$daynum/index.ts" ]; then
+
${gum}/bin/gum style --foreground 212 "TypeScript:"
+
(cd ts/$daynum && ${pkgs.bun}/bin/bun run index.ts)
+
if [ -f "nix/$daynum/solution.nix" ]; then
+
${gum}/bin/gum style --foreground 212 "Nix:"
+
result=$(${pkgs.nix}/bin/nix-instantiate --eval --strict --json nix/$daynum/solution.nix)
+
echo "$result" | ${pkgs.jq}/bin/jq -r 'to_entries | .[] | "\(.key): \(.value)"'
--border-foreground 212 \
···
"$(${gum}/bin/gum style --foreground 212 '🎄 Advent of Code 2025 🎄')"
+
if [ "$action_flag" = "init" ]; then
+
action=$(${gum}/bin/gum choose "Run specific day" "Run all solutions" "Init new day" "Exit")