Last active
August 29, 2015 14:06
-
-
Save gjoseph/a2bcf9f6bca6edcd8a45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pattern=$1 | |
if [ -z $pattern ]; then | |
echo "Please pass a pattern ! (e.g 'modules')" | |
exit -3 | |
fi | |
output=`ssh [email protected] expand $pattern` | |
echo "$output" | grep '^only' > /dev/null | |
there_is_more=$? | |
if [ $there_is_more -eq 0 ]; then | |
echo "Too many repos matched by the $pattern pattern. Refine it to make sure the one you need gets cloned!" | |
echo "" | |
fi | |
filtered_list=`echo "$output" | grep -E '^ (@|#|&| )R' | cut -f3` | |
if [ -z "$filtered_list" ]; then | |
echo "No matching repo found. Please relax your pattern." | |
exit -4 | |
fi | |
echo "Will attempt to clone the following repos:" | |
echo "$filtered_list" | sed 's/^/ /' | |
echo "" | |
echo "$filtered_list" | while read r; do | |
echo "> Cloning $r" | |
#git clone --bare [email protected]:$r $r.git | |
#git clone [email protected]:$r $r.git | |
git clone [email protected]:$r $r | |
echo "" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment