Skip to content

Commit 0b9bfff

Browse files
committed
Update the way we add our /bin to user's $PATH
Follow the suggested code at https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html#zero-handling Signed-off-by: Joe Block <[email protected]>
1 parent 15c7583 commit 0b9bfff

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

git-extra-commands.plugin.zsh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,17 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# Add our plugin's bin diretory to user's path
16-
path+=("${0:h}/bin")
15+
# Add our plugin's bin diretory to user's path per
16+
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html#zero-handling
17+
18+
0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
19+
0="${${(M)0:#/*}:-$PWD/$0}"
20+
21+
local git_extra_commands_bin="${0:h}/bin"
22+
23+
if [[ -z "${path[(r)${git_extra_commands_bin}]}" ]]; then
24+
path+=( "${git_extra_commands_bin}" )
25+
fi
1726

1827
alias git-grab='git-incoming-commits'
1928
alias gitroot='cd $(git rev-parse --show-toplevel) && echo "$_"'

0 commit comments

Comments
 (0)