fix duplicate entries in PATH; especially after executing reload command

pull/483/head
Ivan Povalyukhin 2015-05-19 18:12:54 -07:00
parent 60ce757151
commit 600d1c62de
2 changed files with 11 additions and 4 deletions

View File

@ -361,3 +361,12 @@ all_groups ()
cat $file | sort | uniq
rm $file
}
function __append_uniq_path() {
declare -r new_path="${PATH}:${1}";
if [[ $(echo $new_path | tr ":" "\n" | sort | uniq -d) != *"${1}"* ]]; then
export PATH="${PATH}:${1}";
else
return 1;
fi
}

View File

@ -1,9 +1,7 @@
cite about-plugin
about-plugin 'Node.js helper functions'
export PATH=./node_modules/.bin:$PATH
__append_uniq_path './node_modules/.bin'
# Make sure the global npm prefix is on the path
[[ `which npm` ]] && export PATH=$(npm config get prefix)/bin:$PATH
[[ `which npm` ]] && __append_uniq_path "$(npm config get prefix)/bin"