Skip to content

Commit

Permalink
zsh plugin: use standardized $0 handling
Browse files Browse the repository at this point in the history
  • Loading branch information
carlfriedrich committed Nov 14, 2022
1 parent 4995c61 commit 9471f29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion forgit.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ forgit::warn() { printf "%b[Warn]%b %s\n" '\e[0;33m' '\e[0m' "$@" >&2; }

# set installation path
if [[ -n "$ZSH_VERSION" ]]; then
FORGIT_INSTALL_DIR="$( dirname -- "$0")"
# shellcheck disable=2277,2296,2299
0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
# shellcheck disable=2277,2296,2298
0="${${(M)0:#/*}:-$PWD/$0}"
FORGIT_INSTALL_DIR="${0:h}"
elif [[ -n "$BASH_VERSION" ]]; then
FORGIT_INSTALL_DIR="$(dirname -- "${BASH_SOURCE[0]}")"
else
Expand Down

0 comments on commit 9471f29

Please sign in to comment.