#!/bin/bash

# run as kyle
if [[ $(id -u) -eq 0 ]]; then
  su - kyle
fi


declare -a REPODIRS=("repo" "repo gaming r" "repo r" "repo small projects")

for d in "${REPODIRS[@]}"; do
  cd "$d"
  for r in *; do
    echo -e "\e[00;32mUpdating ${r}\e[00m"
    cd "$r"
    if [[ -d ".git" ]]; then git pull; fi
    if [[ -d ".svn" ]]; then svn up; fi

    if [[ ! $? -eq 0 ]]; then echo 'failed to update repo: ${r}'; fi
    cd ../
  done
  cd ../
done

exit 0