# shellcheck shell=dash

___x_cmd log init kotlin

xrc:mod:lib     kotlin        __setarg_ enginerun load subcmd

# Parsing the argument ...
___x_cmd_kotlin___main(){
    [ "$#" -gt 0 ] || {
        ___x_cmd_kotlin___cmd kotlin
        return
    }

    local op="$1"; shift
    case "$op" in
        load)           ___x_cmd_kotlin_load "$@" ;;
        loaded)         ___X_CMD_KOTLIN_LOADED ;;

        __enginerun)    ___x_cmd_kotlin___enginerun "$@" ;;
        *)              ___x_cmd_kotlin___enginerun "$op" "$@" ;;
    esac
}

___x_cmd_kotlin___cmd(){
    ___x_cmd_kotlin_load || return
    # shellcheck disable=SC2317
    ___x_cmd_kotlin___cmd(){
        command "$@"
    }
    ___x_cmd_kotlin___cmd "$@"
}
