-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathclone.sh
More file actions
20 lines (20 loc) · 822 Bytes
/
clone.sh
File metadata and controls
20 lines (20 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
clone() {
if [ -d "./$1" ]; then
echo -e "${Blue}$1 directory found${Color_Off}"
else
if [ -n "$OPENQ_FORKS" ]; then
IFS=',' read -r -a forks <<< "$OPENQ_FORKS"
for fork in "${forks[@]}"; do
repo_name=$(echo "$fork" | awk -F '/' '{print $2}')
if [ "$repo_name" = "$1" ]; then
username=$(echo "$fork" | awk -F '/' '{print $1}')
echo -e "${UCyan}No $1 directory found. Cloning $1 from $username...${Color_Off}"
git clone "https://github.com/$username/$1.git"
return
fi
done
fi
echo -e "${UCyan}No $1 directory found. Cloning $1 from OpenQDev...${Color_Off}"
git clone https://github.com/OpenQDev/$1.git
fi
}