# shellcheck shell=dash

___x_cmd log init deno

xrc:mod:lib     deno        __setarg_ enginerun load subcmd

# Parsing the argument ...
___x_cmd_deno___main(){
    [ "$#" -gt 0 ] || {
        ( ___x_cmd_deno___cmd deno )
        return
    }

    local op="$1"; shift
    case "$op" in
        load)           ___x_cmd_deno_load "$@" ;;
        loaded)         ___x_cmd_deno_loaded ;;

        "$___X_CMD_ENGINE_SUBCMD_NAME")
                        ___x_cmd_deno___enginerun "$@" ;;
        *)              ___x_cmd_deno___enginerun "$op" "$@" ;;
    esac
}

___x_cmd_deno___cmd(){
    if ___x_cmd_hasbin "$1"; then
        "$@"
        return
    fi
    ___x_cmd snap --run "$@"
}