removed: zshdef

This commit is contained in:
pika 2025-03-17 11:37:27 +01:00
parent e859709cec
commit 03efc49158

62
.zshdef
View file

@ -1,62 +0,0 @@
# ─< Helper functions >─────────────────────────────────────────────────────────────────
# ANSI color codes
RED='\033[0;31m'
CYAN='\033[0;36m'
YELLOW='\033[0;33m'
LIGHT_GREEN='\033[0;92m'
BOLD='\033[1m'
NC='\033[0m' # No Color
# Logging functions with emojis
echo_error() {
local msg="${RED}❌ $1${NC}\n"
# printf "$msg" >&2
_MESSAGES[error]+="$msg"
}
echo_warning() {
local msg="${YELLOW}⚠️ $1${NC}\n"
# printf "$msg"
_MESSAGES[warn]+="$msg"
}
echo_info() {
local msg="${CYAN} $1${NC}\n"
# printf "$msg"
_MESSAGES[info]+="$msg"
}
# ─< proxy config >───────────────────────────────────────────────────────────────────────
proxy() {
case "$1" in
--show)
echo {"http: $http_proxy, $HTTP_PROXY"
"https: $https_proxy, $HTTPS_PROXY"}
;;
*)
echo "You entered something wrong!"
;;
esac
local ip="172.22.11.69"
local port="8080"
# Check if the IP and port are reachable
if nc -z -w5 $ip $port; then
# If reachable, set the proxy environment variables
export http_proxy="http://$ip:$port"
export https_proxy="http://$ip:$port"
export HTTP_PROXY="http://$ip:$port"
export HTTPS_PROXY="http://$ip:$port"
echo_info "Proxy set to: http://$ip:$port" || echo "Proxy set to: http://$ip:$port"
else
echo_error "IP $ip with port $port is not reachable." || echo "IP $ip with port $port is not reachable."
fi
alias proxy='echo "http: $HTTP_PROXY"; echo "https: $HTTPS_PROXY"'
}
# ─< unset proxy >────────────────────────────────────────────────────────────────────────
noproxy() {
unset {HTTP_PROXY,HTTPS_PROXY,http_proxy,https_proxy}
}