# shellcheck shell=dash

___x_cmd_scotty_test(){
    param:void

    local yyname
    local yyid

    {
        read -r yyname
        read -r yyid
    } <"${___X_CMD_ROOT_CODE}/yy.info.txt"

    git clone git@github.com:x-cmd/"$yyname"

    (
        ___x_cmd_inner_cd "$yyname" || {
            scotty:error "Not found $yyname repo"
            return 1
        }

        git checkout -b "$yyid" "$yyid"
        ___x_cmd_inner_cd "mod" || {
            scotty:error "Not found mod directory"
            return 1
        }

        for arg in *; do
            (
                ___x_cmd_inner_cd "$arg" || {
                    scotty:error "Not found mod[$arg] directory"
                    return 1
                }
                scotty:info "Testing $arg module"
                ___x_cmd ws test
                # ___x_cmd test
            )
        done
    )
}
