#!/bin/bash

declare -A mods

mods["rjw"]="https://gitgud.io/Ed86/rjw.git"
mods["rjw-ex"]="https://gitgud.io/Ed86/rjw-ex.git"
mods["rjw-race-support"]="https://gitgud.io/Abraxas/rjw-race-support.git"
mods["rjw-mc"]="https://gitgud.io/Ed86/rjw-mc.git"
mods["Rimworld-Animations"]="https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git"
mods["rjwanimaddons-animalpatch"]="https://gitgud.io/Tory/rjwanimaddons-animalpatch.git"
mods["rjwanimaddons-xtraanims"]="https://gitgud.io/Tory/rjwanimaddons-xtraanims.git"
mods["animaddons-voicepatch"]="https://gitgud.io/Tory/animaddons-voicepatch.git"
mods["licentia-labs"]="https://gitgud.io/John-the-Anabaptist/licentia-labs.git"
mods["nephila-rjw"]="https://gitgud.io/HiveBro/nephila-rjw.git"
mods["RJW_Menstruation"]="https://github.com/moreoreganostodump/RJW_Menstruation.git"
mods["s16s-extension"]="https://gitlab.com/Hazzer/s16s-extension.git"
mods["rjw-events"]="https://gitgud.io/c0ffeeeeeeee/rjw-events.git"
mods["scc-lewd-sculptures"]="https://gitgud.io/SpiritCookieCake/scc-lewd-sculptures.git"
mods["rimjobworld-ideology-addon"]="https://gitgud.io/Tittydragon/rimjobworld-ideology-addon.git"
mods["coffees-rjw-ideology-addons"]="https://gitgud.io/c0ffeeeeeeee/coffees-rjw-ideology-addons.git"
mods["RJW-Sexperience"]="https://github.com/moreoreganostodump/RJW-Sexperience.git"
mods["betterrjw"]="https://gitgud.io/EaglePhntm/betterrjw.git"
mods["Dyspareunia"]="https://gitgud.io/NuttySquabble/Dyspareunia.git"
mods["rimvore-2"]="https://gitlab.com/Nabber/rimvore-2.git"
# mods["rjw-Whorebeds"]="https://gitgud.io/Ed86/rjw-whorebeds.git"
# mods["Rimnosis"]="https://github.com/WolfoftheWest/Rimnosis.git"

function GitUpdate() {
    if [[ -e $1 || -e $1-master ]]; then
        echo "Updating $1..."
        cd $1
        if [[ -e .git ]]; then
            git fetch
            git pull
            cd ..
        else
            cd ..
            echo ".git not found in $(pwd)"
            read -p "Would you like to DELETE $1 and reinstall correctly for auto-update? [Y/n]: "
            if [[ $REPLY == "Y" || $REPLY == "y" ]]; then
                rm -rfv $1
                git clone $2
            fi
        fi
    else
        git clone $2
    fi  
}

for mod in ${!mods[@]}; do
    GitUpdate $mod ${mods[$mod]}
done