
___X_CMD_KOTLIN_LOADED=
___X_CMD_KOTLIN_LOADED(){
    [ -n "$___X_CMD_KOTLIN_LOADED" ]
}

___x_cmd_kotlin_load(){
    ! ___X_CMD_KOTLIN_LOADED || return

    ___x_cmd_kotlin_load_checkenv || {
        x:warn "Cannot find kotlin installed in this current environment"
        ___x_cmd_kotlin_load_env
        return
    }

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

___x_cmd_kotlin_load_env(){
    # TODO: add quiet
    kotlin:info "Loading kotlin in this shell env using 'x env try kotlin'"
    ___x_cmd env try kotlin
    ___x_cmd hascmd java       || x env try java
}

# TODO: Add yes and quiet in the future
___x_cmd_kotlin_load_checkenv(){
    x hascmd kotlin     || return
    x hascmd java       || return
}
