#!/usr/bin/env bash
##makedesc: Install uv (fast Python package manager)

# https://github.com/astral-sh/uv

set -eo pipefail

install() {
    echo
    echo "==============================================="
    echo "Installing uv (fast Python package manager)"
    echo "==============================================="
    echo

    curl -LsSf https://astral.sh/uv/install.sh | sh

    echo
    echo "Finish!"
    uv --version
    echo
}

remove() {
    echo
    echo "==============================================="
    echo "Removing uv"
    echo "==============================================="
    echo

    rm -rf "$HOME/.local/bin/uv" \
        "$HOME/.local/bin/uvx" \
        "$HOME/.local/share/uv"

    echo
    echo "Finish!"
    echo
}

case "$1" in
    r|remove|d|delete|p|purge) remove ;;
    *) install ;;
esac
