detect script directory to make bash and zsh usable without having `powerline` in `$PATH`

This commit is contained in:
Hoang Xuan Phu 2013-05-30 11:12:24 +07:00
parent 540b076aa0
commit 441f17464c
2 changed files with 7 additions and 2 deletions

View File

@ -1,8 +1,11 @@
if test -z "${POWERLINE_COMMAND}" ; then
if which powerline-client &>/dev/null ; then
export POWERLINE_COMMAND=powerline-client
else
elif which powerline &>/dev/null ; then
export POWERLINE_COMMAND=powerline
else
# `$0` is set to `-bash` when using SSH so that won't work
export POWERLINE_COMMAND="$(dirname "$BASH_SOURCE")/../../../scripts/powerline"
fi
fi

View File

@ -1,8 +1,10 @@
if test -z "${POWERLINE_COMMAND}" ; then
if which powerline-client &>/dev/null ; then
export POWERLINE_COMMAND=powerline-client
else
elif which powerline &>/dev/null ; then
export POWERLINE_COMMAND=powerline
else
export POWERLINE_COMMAND="$0:A:h:h:h:h/scripts/powerline"
fi
fi