添加 proxy 函数设置 HTTP 代理

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
FlintyLemming
2026-04-02 17:37:53 +08:00
parent 7d78af37f8
commit fef417bdb6

View File

@@ -140,3 +140,18 @@ abbr -a process 'sudo ps aux | grep'
abbr -a service 'sudo systemctl list-units --type=service --all | grep' abbr -a service 'sudo systemctl list-units --type=service --all | grep'
alias fastfetch="fastfetch --color-keys blue" alias fastfetch="fastfetch --color-keys blue"
function proxy --description 'Set HTTP proxy for current session'
echo -n "HTTP proxy address (e.g. http://192.168.5.14:6152): "
read proxy_addr
if test -n "$proxy_addr"
set -gx HTTP_PROXY "$proxy_addr"
set -gx HTTPS_PROXY "$proxy_addr"
echo "Proxy set: $proxy_addr"
else
echo "Proxy cleared"
set -e HTTP_PROXY
set -e HTTPS_PROXY
end
end