22cite about-plugin
33about-plugin ' Proxy Tools'
44
5- function disable-proxy()
6- {
5+ function disable-proxy() {
76 about ' Disables proxy settings for Bash, npm and SSH'
87 group ' proxy'
98
@@ -21,8 +20,7 @@ function disable-proxy()
2120 svn-disable-proxy
2221}
2322
24- function enable-proxy()
25- {
23+ function enable-proxy() {
2624 about ' Enables proxy settings for Bash, npm and SSH'
2725 group ' proxy'
2826
@@ -40,8 +38,7 @@ function enable-proxy()
4038 svn-enable-proxy
4139}
4240
43- function enable-proxy-alt()
44- {
41+ function enable-proxy-alt() {
4542 about ' Enables alternate proxy settings for Bash, npm and SSH'
4643 group ' proxy'
4744
@@ -59,8 +56,7 @@ function enable-proxy-alt()
5956 svn-enable-proxy " ${http_proxy:- } "
6057}
6158
62- function show-proxy()
63- {
59+ function show-proxy() {
6460 about ' Shows the proxy settings for Bash, Git, npm and SSH'
6561 group ' proxy'
6662
@@ -76,8 +72,7 @@ function show-proxy()
7672 ssh-show-proxy
7773}
7874
79- function proxy-help()
80- {
75+ function proxy-help() {
8176 about ' Provides an overview of the bash-it proxy configuration'
8277 group ' proxy'
8378
9893 bash-it-show-proxy
9994}
10095
101- function bash-it-show-proxy()
102- {
96+ function bash-it-show-proxy() {
10397 about ' Shows the bash-it proxy settings'
10498 group ' proxy'
10599
@@ -111,89 +105,77 @@ function bash-it-show-proxy()
111105 env | grep -e " BASH_IT.*PROXY"
112106}
113107
114- function npm-show-proxy()
115- {
108+ function npm-show-proxy() {
116109 about ' Shows the npm proxy settings'
117110 group ' proxy'
118111
119- if _command_exists npm
120- then
112+ if _command_exists npm; then
121113 echo " "
122114 echo " npm"
123115 echo " ==="
124- echo " npm HTTP proxy: " ` npm config get proxy`
125- echo " npm HTTPS proxy: " ` npm config get https-proxy`
126- echo " npm proxy exceptions: " ` npm config get noproxy`
116+ echo " npm HTTP proxy: $( npm config get proxy) "
117+ echo " npm HTTPS proxy: $( npm config get https-proxy) "
118+ echo " npm proxy exceptions: $( npm config get noproxy) "
127119 fi
128120}
129121
130- function npm-disable-proxy()
131- {
122+ function npm-disable-proxy() {
132123 about ' Disables npm proxy settings'
133124 group ' proxy'
134125
135- if _command_exists npm
136- then
126+ if _command_exists npm; then
137127 npm config delete proxy
138128 npm config delete https-proxy
139129 npm config delete noproxy
140130 _log_notice " Disabled npm proxy settings"
141131 fi
142132}
143133
144- function npm-enable-proxy()
145- {
134+ function npm-enable-proxy() {
146135 about ' Enables npm proxy settings'
147136 group ' proxy'
148137
149138 local my_http_proxy=" ${1:- ${BASH_IT_HTTP_PROXY:- } } "
150139 local my_https_proxy=" ${2:- ${BASH_IT_HTTPS_PROXY:- } } "
151140 local my_no_proxy=" ${3:- ${BASH_IT_NO_PROXY:- } } "
152141
153- if _command_exists npm
154- then
142+ if _command_exists npm; then
155143 npm config set proxy " ${my_http_proxy:? } " || return
156144 npm config set https-proxy " ${my_https_proxy:? } " || return
157145 npm config set noproxy " ${my_no_proxy:- } " || return
158146 _log_notice " Enabled npm proxy settings"
159147 fi
160148}
161149
162- function git-global-show-proxy()
163- {
150+ function git-global-show-proxy() {
164151 about ' Shows global Git proxy settings'
165152 group ' proxy'
166153
167- if _command_exists git
168- then
154+ if _command_exists git; then
169155 echo " "
170156 echo " Git (Global Settings)"
171157 echo " ====================="
172- echo " Git (Global) HTTP proxy: " ` git config --global --get http.proxy`
173- echo " Git (Global) HTTPS proxy: " ` git config --global --get https.proxy`
158+ echo " Git (Global) HTTP proxy: $( git config --global --get http.proxy) "
159+ echo " Git (Global) HTTPS proxy: $( git config --global --get https.proxy) "
174160 fi
175161}
176162
177- function git-global-disable-proxy()
178- {
163+ function git-global-disable-proxy() {
179164 about ' Disables global Git proxy settings'
180165 group ' proxy'
181166
182- if _command_exists git
183- then
167+ if _command_exists git; then
184168 git config --global --unset-all http.proxy
185169 git config --global --unset-all https.proxy
186170 _log_notice " Disabled global Git proxy settings"
187171 fi
188172}
189173
190- function git-global-enable-proxy()
191- {
174+ function git-global-enable-proxy() {
192175 about ' Enables global Git proxy settings'
193176 group ' proxy'
194177
195- if _command_exists git
196- then
178+ if _command_exists git; then
197179 git-global-disable-proxy
198180
199181 git config --global --add http.proxy " ${BASH_IT_HTTP_PROXY:? } "
@@ -202,40 +184,34 @@ function git-global-enable-proxy()
202184 fi
203185}
204186
205- function git-show-proxy()
206- {
187+ function git-show-proxy() {
207188 about ' Shows current Git project proxy settings'
208189 group ' proxy'
209190
210- if _command_exists git
211- then
191+ if _command_exists git; then
212192 echo " Git Project Proxy Settings"
213193 echo " ====================="
214- echo " Git HTTP proxy: " ` git config --get http.proxy`
215- echo " Git HTTPS proxy: " ` git config --get https.proxy`
194+ echo " Git HTTP proxy: $( git config --get http.proxy) "
195+ echo " Git HTTPS proxy: $( git config --get https.proxy) "
216196 fi
217197}
218198
219- function git-disable-proxy()
220- {
199+ function git-disable-proxy() {
221200 about ' Disables current Git project proxy settings'
222201 group ' proxy'
223202
224- if _command_exists git
225- then
203+ if _command_exists git; then
226204 git config --unset-all http.proxy
227205 git config --unset-all https.proxy
228206 _log_notice " Disabled Git project proxy settings"
229207 fi
230208}
231209
232- function git-enable-proxy()
233- {
210+ function git-enable-proxy() {
234211 about ' Enables current Git project proxy settings'
235212 group ' proxy'
236213
237- if _command_exists git
238- then
214+ if _command_exists git; then
239215 git-disable-proxy
240216
241217 git config --add http.proxy " ${BASH_IT_HTTP_PROXY:? } "
@@ -244,18 +220,15 @@ function git-enable-proxy()
244220 fi
245221}
246222
247-
248- function svn-show-proxy()
249- {
223+ function svn-show-proxy() {
250224 about ' Shows SVN proxy settings'
251225 group ' proxy'
252226
253- if _command_exists svn && _command_exists python2
254- then
227+ if _command_exists svn && _command_exists python2; then
255228 echo " "
256229 echo " SVN Proxy Settings"
257230 echo " =================="
258- python2 - << END
231+ python2 - << END
259232import ConfigParser, os
260233config = ConfigParser.ConfigParser()
261234config.read(os.path.expanduser('~/.subversion/servers'))
@@ -276,14 +249,12 @@ END
276249 fi
277250}
278251
279- function svn-disable-proxy()
280- {
252+ function svn-disable-proxy() {
281253 about ' Disables SVN proxy settings'
282254 group ' proxy'
283255
284- if _command_exists svn_command_exists python2
285- then
286- python2 - << END
256+ if _command_exists svn_command_exists python2; then
257+ python2 - << END
287258import ConfigParser, os
288259config = ConfigParser.ConfigParser()
289260config.read(os.path.expanduser('~/.subversion/servers'))
@@ -306,16 +277,14 @@ END
306277 fi
307278}
308279
309- function svn-enable-proxy()
310- {
280+ function svn-enable-proxy() {
311281 about ' Enables SVN proxy settings'
312282 group ' proxy'
313283
314- if _command_exists svn _command_exists python2
315- then
284+ if _command_exists svn _command_exists python2; then
316285 local my_http_proxy=" ${1:- ${BASH_IT_HTTP_PROXY:- } } "
317286
318- python2 - " ${my_http_proxy:? } " " ${BASH_IT_NO_PROXY:- } " << END
287+ python2 - " ${my_http_proxy:? } " " ${BASH_IT_NO_PROXY:- } " << END
319288import ConfigParser, os, sys, urlparse
320289pieces = urlparse.urlparse(sys.argv[1])
321290host = pieces.hostname
@@ -344,13 +313,11 @@ END
344313 fi
345314}
346315
347- function ssh-show-proxy()
348- {
316+ function ssh-show-proxy() {
349317 about ' Shows SSH config proxy settings (from ~/.ssh/config)'
350318 group ' proxy'
351319
352- if [ -f ~ /.ssh/config ]
353- then
320+ if [ -f ~ /.ssh/config ]; then
354321 echo " "
355322 echo " SSH Config Enabled in ~/.ssh/config"
356323 echo " ==================================="
@@ -382,27 +349,22 @@ function ssh-show-proxy()
382349 fi
383350}
384351
385- function ssh-disable-proxy()
386- {
352+ function ssh-disable-proxy() {
387353 about ' Disables SSH config proxy settings'
388354 group ' proxy'
389355
390- if [ -f ~ /.ssh/config ]
391- then
392- sed -e' s/^.*ProxyCommand/# ProxyCommand/' " ${BASH_IT_SED_I_PARAMETERS[@]} " ~ /.ssh/config
356+ if [ -f ~ /.ssh/config ]; then
357+ sed -e' s/^.*ProxyCommand/# ProxyCommand/' " ${BASH_IT_SED_I_PARAMETERS[@]} " ~ /.ssh/config
393358 _log_notice " Disabled SSH config proxy settings"
394359 fi
395360}
396361
397-
398- function ssh-enable-proxy()
399- {
362+ function ssh-enable-proxy() {
400363 about ' Enables SSH config proxy settings'
401364 group ' proxy'
402365
403- if [ -f ~ /.ssh/config ]
404- then
405- sed -e' s/# ProxyCommand/ ProxyCommand/' " ${BASH_IT_SED_I_PARAMETERS[@]} " ~ /.ssh/config
366+ if [ -f ~ /.ssh/config ]; then
367+ sed -e' s/# ProxyCommand/ ProxyCommand/' " ${BASH_IT_SED_I_PARAMETERS[@]} " ~ /.ssh/config
406368 _log_notice " Enabled SSH config proxy settings"
407369 fi
408370}
0 commit comments