#!/usr/bin/env bash
##makedesc: Install llmfit

# https://github.com/AlexsJones/llmfit

set -eo pipefail

mkdir -p "$HOME/install"

install() {
    echo
    echo "==============================================="
    echo "Installing llmfit (latest)"
    echo "==============================================="
    echo
    curl -fsSL https://llmfit.axjns.dev/install.sh | sh -s -- --local
    echo
    echo "Finish!"
}

upgrade() {
    echo
    echo "==============================================="
    echo "Upgrading llmfit"
    echo "==============================================="
    echo
    curl -fsSL https://llmfit.axjns.dev/install.sh | sh -s -- --local
    echo
    echo "Finish!"
}

remove() {
    echo
    echo "==============================================="
    echo "Removing llmfit"
    echo "==============================================="
    echo
    sudo rm -rf "$(which llmfit)"
    echo
    echo "Finish!"
    echo
}

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

