mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
zsh plugin: use standardized $0 handling
See https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html#zero-handling
This commit is contained in:
parent
4995c614e4
commit
9471f292bb
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue