#!/bin/bash set -e EXAMPLE=$1 if [ -z "$EXAMPLE" ]; then echo "Usage: $0 " echo "Available examples:" ls examples/*.rs | sed 's/examples\///' | sed 's/\.rs$//' | sed 's/^/ - /' exit 1 fi # Check if example exists if [ ! -f "examples/${EXAMPLE}.rs" ]; then echo "Error: Example 'examples/${EXAMPLE}.rs' not found" exit 1 fi cd "$(dirname "$0")/.." # Start immich if not running if ! curl -s http://localhost:2283/api/server/ping > /dev/null 2>&1; then echo "Immich is not running. Starting..." ./scripts/start-immich.sh fi # Seed data if not already done if [ ! -f .seeded ]; then echo "Seeding test data..." ./scripts/seed-data.sh touch .seeded fi # Load environment variables # set -a exports all variables defined from here on set -a source .env.test set +a # Run the example echo "Running example: $EXAMPLE" cargo run --example "$EXAMPLE"