forked from donnemartin/dev-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm2switch
executable file
·48 lines (45 loc) · 852 Bytes
/
m2switch
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
48
#!/usr/bin/env bash
switch()
{
if [ -e "${HOME}/.m2" ];
then
if [ -e "${HOME}/.m2.personal" ];
then
mv "${HOME}/.m2" "${HOME}/.m2.work"
mv "${HOME}/.m2.personal" "${HOME}/.m2"
echo "Personal Maven Repository"
elif [ -e "${HOME}/.m2.work" ];
then
mv "${HOME}/.m2" "${HOME}/.m2.personal"
mv "${HOME}/.m2.work" "${HOME}/.m2"
echo "Work Maven Repository"
else
echo "No alternate maven repository"
fi
else
echo "No .m2 folder found"
fi
}
if [ "$#" -gt 0 ];
then
while getopts ":c" opt; do
case $opt in
c)
if [ -e "${HOME}/.m2.personal" ];
then
echo "Using Work Repository"
elif [ -e "${HOME}/.m2.work" ];
then
echo "Using Personal Repository"
else
echo "No alternative maven repository"
fi
;;
\?)
echo "-c: Show current maven repository"
;;
esac
done
else
switch
fi