-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cloneP.sh
47 lines (41 loc) · 846 Bytes
/
.cloneP.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
touch ~/.cloneP_username.txt
USER=`cat ~/.cloneP_username.txt`
if [ -z $1 ] || [ $1 == '-help' ]
then
echo "Usage : cloneP -u -help [Project_name] [File_name]"
exit
fi
if [ "$1" == "-u" ]
then
if [ -z $2 ]
then
echo "Usage : cloneP Project_name [File_name]"
echo " cloneP -u Username"
echo " cloneP -help"
exit
fi
touch ~/.cloneP_username.txt
echo "$2" > ~/.cloneP_username.txt
exit
fi
if [ -z $USER ]
then
echo "User not defined"
echo "Please run \`cloneP -u Username\`"
exit
fi
if [ -e $1 ] && [ -z $2 ]
then
echo "The file already exist"
exit
fi
echo "Downloading the $1 Repository..."
git clone --progress https://github.com/$USER/$1.git $2 2> ./.result
RES=`cat ./.result | grep 'done' | wc -l`
rm ./.result
if [ $RES == 5 ]
then
echo "\033[32mSuccess\033[0m"
else
echo "\033[31mFailure\033[0m"
fi