Add simulation of hub clone

I don't want to get a full hub install, not yet anyway.
master
nirenjan 2018-05-03 14:09:28 -07:00
parent 50d31b6c7e
commit d2f9c5cdc7
1 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,42 @@
#!/bin/bash -x
#
# Support script to simplify cloning from GitHub
MY_GH_UID=nirenjan
USAGE="Usage: git ${0#*/git-} [<owner>/]<repo>[.git]"
if [[ -z "$1" ]]
then
echo "$USAGE" >&2
exit 1
fi
# Extract OWNER
OWNER=
if [[ "$1" == */* ]]
then
OWNER=${1%/*}
fi
REPO=${1%.git}
REPO=${REPO##*/}
if [[ -z "$OWNER" ]]
then
URL="my:"
elif [[ "$OWNER" == "$MY_GH_UID" ]]
then
URL="my:"
else
URL="gh:$OWNER/"
fi
if [[ -z "$REPO" ]]
then
echo "$USAGE" >&2
exit 1
fi
shift
git clone $URL$REPO.git "$@"