# shellcheck shell=dash

___x_cmd_xgo___setarg_(){
    x_="set --"

    local i=1
    local justadd=
    while [ "$#" -gt 0 ]; do
        if [ -n "$justadd" ]; then
            shift; i=$((i+1))
            x_="$x_ \"\$$i\""
        else
            case "$1" in
                -*c|-|-m)       x_=""; return ;;
                --)             shift; i=$((i+1)); x_="$x_ --"; false   ;;
                -W|-X|--check-hash-based-pycs)
                                x_="$x_ \"\$$i\" \"\$$((i+1))\""
                                shift 2
                                i=$((i+2))
                                continue
                                ;;
                -*)             x_="$x_ \"\$$i\""   ;;
                *)              false ;;
            esac || {
                if ___x_cmd_which_one "$1" 2>/dev/null && [ "$___X_CMD_WHICH_ONE_RESOURCE_TYPE" != "official" ] ; then
                    xgo:debug "Found file ==> $___X_CMD_WHICH_ONE_RESULT"
                    ___X_CMD_XGO_WHICHFILE="$___X_CMD_WHICH_ONE_RESULT"
                    x_="$x_ \"\$___X_CMD_XGO_WHICHFILE\""
                    justadd=1
                    continue
                fi

                x_=""
                xgo:error "Abort because file path is unknown ==> $1"
                xgo:error "If you want more log ==> x log +xgo"
                return 1
            }
        fi
        shift
        i=$((i+1))
    done
    xgo:debug "Args ==> $*"
}
