#!/bin/bash

set -e

# Check if uv is installed
if ! command -v uv &> /dev/null
then
    install_script="curl -LsSf https://astral.sh/uv/install.sh | sh"

    echo "Our python package and environment manger, uv, is not installed. You can either:"
    echo "1. Install it via your system package manager *before* proceeding"
    echo "2. Allow running the following install script:"
    echo "    $install_script"
    # Ask user which option they want
    read -n1 -p "Which option would you like to choose? [1/2]: " option
    if [ "$option" == "2" ]; then
        echo "Running install script..."
        eval $install_script
    # If uv is not detected
    elif ! command -v uv &> /dev/null; then
        echo "uv was not detected. You may need to restart your shell (or source .bashrc, .zshrc, or similar) if you installed it."
        exit 1
    else
        echo "You're good to go! This message will not appear again."
    fi
fi

# uv run --project src/bells/bells src/bells/bells/bell.py "$@"
uv run --frozen src/bells/bells/bell.py "$@"
