# shellcheck shell=dash
___X_CMD_OLLAMA_RUN_LASTFP="$___X_CMD_ROOT_DATA/ollama/last_model"

___x_cmd_ollama_run(){
    ollama:info "running -> x ollama run $*"

    [ $# -eq 0 ] || {
        ___x_cmd_ollama___bin run "$@"
        return
    }

    local model=llama3
    if [ -f "$___X_CMD_OLLAMA_RUN_LASTFP" ]; then
        read -r model <"$___X_CMD_OLLAMA_RUN_LASTFP"
    fi

    local id
    ___x_cmd ui select id "No model specified. Next:"   \
        "x ollama run $model"   \
        "x ollama ls"           \
        "return 0"

    case "$id" in
        1)      ___x_cmd ollama run "$model" ;;
        2)      ___x_cmd ollama ls ;;
        *)      return 0
    esac

}
