Diff
1diff --git a/plugins/aliases/aliases.plugin.zsh b/plugins/aliases/aliases.plugin.zsh
2index 4e1e0558ecaf4c6a91a8bde1319d9011b0353701..9864de957a1d764277d98b10b550a6401d1d1a12 100644
3--- a/plugins/aliases/aliases.plugin.zsh
4+++ b/plugins/aliases/aliases.plugin.zsh
5@@ -1,11 +1,14 @@
6-# with lots of 3rd-party amazing aliases installed, just need something to explore it quickly.
7-#
8-# - acs: alias cheatsheet
9-# group alias by command, pass addition argv to grep.
10-function acs(){
11- (( $+commands[python3] )) || {
12- echo "[error] No python executable detected"
13- return
14+# Handle $0 according to the standard:
15+# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
16+0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
17+0="${${(M)0:#/*}:-$PWD/$0}"
18+
19+eval '
20+ function acs(){
21+ (( $+commands[python3] )) || {
22+ echo "[error] No python executable detected"
23+ return
24+ }
25+ alias | python3 "'"${0:h}"'/cheatsheet.py" "$@"
26 }
27- alias | python3 ${functions_source[$0]:h}/cheatsheet.py $@
28-}
29+'
30diff --git a/plugins/shell-proxy/shell-proxy.plugin.zsh b/plugins/shell-proxy/shell-proxy.plugin.zsh
31index 9d45b52691d756fc726442227916ab54e7faf562..4fdbe9322025d36fdadc8c8ba94aa521d2002ad2 100644
32--- a/plugins/shell-proxy/shell-proxy.plugin.zsh
33+++ b/plugins/shell-proxy/shell-proxy.plugin.zsh
34@@ -1,32 +1,39 @@
35 #!/usr/bin/bash
36 # shellcheck disable=SC1090,SC2154
37
38-proxy() {
39- # deprecate $DEFAULT_PROXY, use SHELLPROXY_URL instead
40- if [[ -n "$DEFAULT_PROXY" && -z "$SHELLPROXY_URL" ]]; then
41- echo >&2 "proxy: DEFAULT_PROXY is deprecated, use SHELLPROXY_URL instead"
42- SHELLPROXY_URL="$DEFAULT_PROXY"
43- unset DEFAULT_PROXY
44- fi
45-
46- # deprecate CONFIG_PROXY, use SHELLPROXY_CONFIG instead
47- if [[ -n "$CONFIG_PROXY" && -z "$SHELLPROXY_CONFIG" ]]; then
48- echo >&2 "proxy: CONFIG_PROXY is deprecated, use SHELLPROXY_CONFIG instead"
49- SHELLPROXY_CONFIG="$CONFIG_PROXY"
50- unset CONFIG_PROXY
51- fi
52-
53- # the proxy.py script is in the same directory as this function
54- local proxy="${functions_source[$0]:A:h}/proxy.py"
55-
56- # capture the output of the proxy script and bail out if it fails
57- local output
58- output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" ||
59- return $?
60-
61- # evaluate the output generated by the proxy script
62- source <(echo "$output")
63-}
64+# Handle $0 according to the standard:
65+# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
66+0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
67+0="${${(M)0:#/*}:-$PWD/$0}"
68+
69+eval '
70+ proxy() {
71+ # deprecate $DEFAULT_PROXY, use SHELLPROXY_URL instead
72+ if [[ -n "$DEFAULT_PROXY" && -z "$SHELLPROXY_URL" ]]; then
73+ echo >&2 "proxy: DEFAULT_PROXY is deprecated, use SHELLPROXY_URL instead"
74+ SHELLPROXY_URL="$DEFAULT_PROXY"
75+ unset DEFAULT_PROXY
76+ fi
77+
78+ # deprecate CONFIG_PROXY, use SHELLPROXY_CONFIG instead
79+ if [[ -n "$CONFIG_PROXY" && -z "$SHELLPROXY_CONFIG" ]]; then
80+ echo >&2 "proxy: CONFIG_PROXY is deprecated, use SHELLPROXY_CONFIG instead"
81+ SHELLPROXY_CONFIG="$CONFIG_PROXY"
82+ unset CONFIG_PROXY
83+ fi
84+
85+ # the proxy.py script is in the same directory as this function
86+ local proxy="'"${0:h}"'/proxy.py"
87+
88+ # capture the output of the proxy script and bail out if it fails
89+ local output
90+ output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" ||
91+ return $?
92+
93+ # evaluate the output generated by the proxy script
94+ source <(echo "$output")
95+ }
96+'
97
98 _proxy() {
99 local -r commands=('enable' 'disable' 'status')