2013-11-14 18:12:05 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
_printhelp ()
|
|
|
|
{
|
|
|
|
cat<<EOF
|
|
|
|
Usage: ${1##*/} [OPTIONS] REPOS
|
|
|
|
|
|
|
|
Clone multiple git repos from \$DOMAIN:\$USER.
|
|
|
|
|
|
|
|
Synopsis:
|
|
|
|
|
|
|
|
-h: Show this help.
|
|
|
|
-d DOMAIN: Set domain.
|
2013-11-28 15:10:57 +01:00
|
|
|
-u USER: Set the repository owner.
|
2013-11-14 18:12:05 +01:00
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
DOMAIN=bitbucket.org
|
|
|
|
USER=ambrevar
|
|
|
|
while getopts ":hd:u:" opt; do
|
|
|
|
case $opt in
|
|
|
|
h)
|
|
|
|
_printhelp "$0"
|
|
|
|
exit 1 ;;
|
|
|
|
d)
|
|
|
|
DOMAIN=$OPTARG ;;
|
|
|
|
u)
|
|
|
|
USER=$OPTARG ;;
|
|
|
|
?)
|
|
|
|
_printhelp "$0"
|
|
|
|
exit 1 ;;
|
|
|
|
:)
|
|
|
|
_printhelp "$0"
|
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
_printhelp "$0"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ! command -v git >/dev/null; then
|
|
|
|
echo >&2 "git required."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
for i; do
|
|
|
|
git clone git@$DOMAIN:/$USER/$i
|
|
|
|
done
|