#!/bin/bash
# 
# Add a remote based on a username

GITLAB_ROOT=git@gitlab.science.gc.ca
[ -z "$1" ] && { echo "ERROR: You provide the username as the first argument" ; exit 1 ; }

# Verify that we are in the super-repo
[ -d CanAM ] ||  { echo "ERROR: You MUST be in the CanESM super-repo" ; exit 1 ; }

# Add the remote based on the name of the submodule 
git submodule foreach --recursive "git remote add $1 $GITLAB_ROOT:$1/\$name.git"
git remote add $1 $GITLAB_ROOT:$1/CanESM5.git
