From 761ea3b890c342f2046723b8db1ab615fcc984b4 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Sun, 12 Feb 2017 16:46:30 +0100 Subject: [PATCH] I wonder if I have been too far with this... --- bashrc | 2 +- scripts/debloc | 7 +++++++ scripts/proxy | 35 +++++++++++++++++++++++++---------- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/bashrc b/bashrc index 69cb8f7..837c5b9 100644 --- a/bashrc +++ b/bashrc @@ -47,7 +47,7 @@ alias la="ls -la $LS_OPTIONS" alias al=sl alias x='startx; logout' alias s='sudo -s -E' -alias po='proxy off' +alias po='eval $(proxy off)' alias nw="sudo systemctl restart NetworkManager" alias mc="machines" # Superseding commands with better ones if they are present diff --git a/scripts/debloc b/scripts/debloc index 478b15e..6f2c5d4 100755 --- a/scripts/debloc +++ b/scripts/debloc @@ -245,6 +245,13 @@ function _debloc-installDeps { # package # PUBLIC FUNCTIONS +function proxy_set_help { + echo "Usage: $0 env" + echo + echo "Examples:" + echo ' eval "$(debloc env)"' + return 0 +} function debloc_env { echo "export PATH=\"$DEBLOC_ROOT/usr/bin:$DEBLOC_ROOT/usr/games/:$DEBLOC_ROOT/usr/lib/git-core:\$PATH\"" echo "export LIBRARY_PATH=\"$DEBLOC_LD:\$LIBRARY_PATH\"" diff --git a/scripts/proxy b/scripts/proxy index 6da0e0f..44322b5 100755 --- a/scripts/proxy +++ b/scripts/proxy @@ -7,6 +7,9 @@ function proxy_set_help { echo echo "Arguments:" echo " ADDRESS Address of the proxy" + echo + echo "Examples:" + echo ' eval "$(proxy set http://proxy.mycompany.com:3128/)"' return 0 } @@ -15,14 +18,20 @@ function proxy_set { proxy_set_help return 1 fi - export http_proxy=$1 - export https_proxy=$1 - export ftp_proxy=$1 - export rsync_proxy=$1 - echo "Proxy set" + echo "export http_proxy='$1'" + echo "export https_proxy='$1'" + echo "export ftp_proxy='$1'" + echo "export rsync_proxy='$1'" exit 0 } +function proxy_setup_help { + echo "Usage: $0 setup" + echo + echo "Examples:" + echo " proxy_set # Then eval the output" + return 0 +} function proxy_setup { export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com" @@ -49,12 +58,18 @@ function proxy_setup { return 0 } +function proxy_off_help { + echo "Usage: $0 off" + echo + echo "Examples:" + echo ' eval $(proxy off)' + return 0 +} function proxy_off { - unset http_proxy - unset https_proxy - unset ftp_proxy - unset rsync_proxy - echo -e "Proxy removed" + echo 'unset http_proxy' + echo 'unset https_proxy' + echo 'unset ftp_proxy' + echo 'unset rsync_proxy' return 0 }