# shellcheck shell=dash
___X_CMD_DENO_LOADED=
___x_cmd_deno_loaded(){
    [ -n "$___X_CMD_DENO_LOADED" ]
}

___x_cmd_deno_load(){
    ! ___x_cmd_deno_loaded || return 0

    ___x_cmd_deno_load_checkenv || {
        deno:debug "Cannot find deno installed in this current environment"
        ___x_cmd snap --run deno --version >/dev/null
        return
    }

    # TODO: In the future, we need to check the current version is good enough.

    ___X_CMD_DENO_LOADED=1
}


# TODO: Add yes and quiet in the future
___x_cmd_deno_load_checkenv(){
    ___x_cmd hascmd deno   || return
}
