forked from DingZaiHub/wxappUnpacker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy_set.sh
executable file
·59 lines (53 loc) · 1.25 KB
/
proxy_set.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
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
# npm config set proxy http:web-proxy.tencent.com:8080
# npm config set proxy http://127.0.0.1:12759
npm_set_proxy()
{
if [ "-s" == "$1" ]
then
echo "npm config set proxy http://127.0.0.1:12759"
npm config set proxy http://127.0.0.1:12759
echo "npm config set https-proxy http://127.0.0.1:12759"
npm config set https-proxy http://127.0.0.1:12759
elif [ "-d" == "$1" ]
then
echo "npm config delete proxy"
npm config delete proxy
echo "npm config delete https-proxy"
npm config delete https-proxy
fi
return 0;
}
git_set_proxy()
{
if [ "-s" == "$1" ]
then
echo "npm config set proxy http://127.0.0.1:12759"
npm config set proxy http://127.0.0.1:12759
echo "npm config set https-proxy http://127.0.0.1:12759"
npm config set https-proxy http://127.0.0.1:12759
elif [ "-d" == "$1" ]
then
echo "npm config delete proxy"
npm config delete proxy
echo "npm config delete https-proxy"
npm config delete https-proxy
fi
return 0;
}
check_menu()
{
menu=$1
args=$2
param=$3
if [ "-git" == "$1" ]
then git_set_proxy $args $param
elif [ "-npm" == "$1" ]
then
npm_set_proxy $args $param
else npm_set_proxy $1 $2
fi
return 0;
}
# 菜单
check_menu $1 $2 $3