Added gitgrab.sh
parent
4c4a8ca873
commit
2c1afe5edd
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
GREEN=`tput setaf 2`
|
||||||
|
BLUE=`tput setaf 4`
|
||||||
|
RED=`tput setaf 1`
|
||||||
|
PURPLE=`tput setaf 5`
|
||||||
|
printf "\n"
|
||||||
|
echo $BLUE"GitGrab:$GREEN A tool that grabs your git clones from your .zsh_history and puts them in one folder for easy transfer"
|
||||||
|
echo $BLUE"----------------"
|
||||||
|
|
||||||
|
gits=$(grep "git clone" $HOME/.zsh_history | rev | awk '{print $1,$2,$3}' | rev | cut -d ';' -f2 | grep -Eo "(http|https)://[a-zA-Z0-9.]+/[a-zA-Z0-9.-]*/[a-zA-Z0-9.-]*" | sort -u)
|
||||||
|
|
||||||
|
if test -d "tools"; then
|
||||||
|
cd tools
|
||||||
|
else
|
||||||
|
mkdir tools
|
||||||
|
cd tools
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for i in $gits; do
|
||||||
|
echo -ne $BLUE"Requesting: $PURPLE$i:"
|
||||||
|
git clone $i 2>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo -ne $GREEN" ✓"
|
||||||
|
else
|
||||||
|
echo -ne $RED" x"
|
||||||
|
fi
|
||||||
|
printf "\n"
|
||||||
|
done
|
Loading…
Reference in New Issue