2017-04-20 22:27:32 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# mfadd
|
|
|
|
#
|
|
|
|
# Add a remote and fetch it
|
|
|
|
#
|
|
|
|
|
2017-07-02 21:43:57 -04:00
|
|
|
[[ $# == 1 ]] || { echo "Usage: `basename $0` user" 1>&2 ; exit 1; }
|
2017-04-20 22:27:32 -04:00
|
|
|
|
2017-07-02 21:43:57 -04:00
|
|
|
USER=$1
|
2017-04-20 22:27:32 -04:00
|
|
|
|
2017-07-02 21:43:57 -04:00
|
|
|
MFINFO=$(mfinfo) || exit 1
|
|
|
|
IFS=' ' read -a INFO <<< "$MFINFO"
|
2017-04-20 22:27:32 -04:00
|
|
|
REPO=${INFO[2]}
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo "Adding and fetching $USER..."
|
2017-07-02 21:43:57 -04:00
|
|
|
git remote add "$USER" "git@github.com:$USER/$REPO.git"
|
|
|
|
git fetch "$USER"
|