2 # shellcheck disable=SC1090,SC2154
4 # Handle $0 according to the standard:
5 # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
6 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
7 0="${${(M)0:#/*}:-$PWD/$0}"
11 # deprecate $DEFAULT_PROXY, use SHELLPROXY_URL instead
12 if [[ -n "$DEFAULT_PROXY" && -z "$SHELLPROXY_URL" ]]; then
13 echo >&2 "proxy: DEFAULT_PROXY is deprecated, use SHELLPROXY_URL instead"
14 SHELLPROXY_URL="$DEFAULT_PROXY"
18 # deprecate CONFIG_PROXY, use SHELLPROXY_CONFIG instead
19 if [[ -n "$CONFIG_PROXY" && -z "$SHELLPROXY_CONFIG" ]]; then
20 echo >&2 "proxy: CONFIG_PROXY is deprecated, use SHELLPROXY_CONFIG instead"
21 SHELLPROXY_CONFIG="$CONFIG_PROXY"
25 # the proxy.py script is in the same directory as this function
26 local proxy="'"${0:h}"'/proxy.py"
28 # capture the output of the proxy script and bail out if it fails
30 output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" ||
33 # evaluate the output generated by the proxy script
34 source <(echo "$output")
39 local -r commands=('enable' 'disable' 'status')
41 compadd -S '' "${commands[@]}"