Skip to content

Commit

Permalink
fix buggy arg parsing in plenv-init
Browse files Browse the repository at this point in the history
  • Loading branch information
ap committed Nov 11, 2015
1 parent b0945d5 commit 6d2c8cc
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions libexec/plenv-init
Expand Up @@ -6,21 +6,20 @@ set -e
[ -n "$PLENV_DEBUG" ] && set -x

print=""
no_rehash=1
for args in "$@"
do
if [ "$args" = "-" ]; then
print=1
shift
fi
shell=""

if [ "$args" = "--no-rehash" ]; then
no_rehash=1
shift
fi
for arg in "$@" ; do
case "$arg" in
- )
print=1
;;
--no-rehash )
;;
* )
[ -z "$shell" ] && shell="$arg"
esac
done

shell="$1"
if [ -z "$shell" ]; then
shell="$(ps c -p $(ps -p $$ -o 'ppid=' 2>/dev/null) -o 'comm=' 2>/dev/null || true)"
shell="${shell##-}"
Expand Down Expand Up @@ -112,10 +111,6 @@ fish )
;;
esac
if [ -z "$no_rehash" ]; then
echo 'plenv rehash 2>/dev/null'
fi
commands=(`plenv-commands --sh`)
case "$shell" in
fish )
Expand Down

0 comments on commit 6d2c8cc

Please sign in to comment.