Added the path plugin.

This commit is contained in:
Cary Robbins 2014-06-07 09:01:02 -05:00
parent 3913106b2e
commit bbff007e92

View File

@ -0,0 +1,23 @@
# Path Plugin
# -----------
# Adds each line from $HOME/.path to your PATH variable.
# Environment variables will be evaluated in this file for you, so you
# can use references like $HOME/bin.
#
# Use `reload_path` to update $PATH if you change $HOME/.path
function reload_path() {
if [ $CUSTOM_PATH ]; then
# Determine what the original path was before we modified it be removing
# our CUSTOM_PATH. This way we don't double-up entries on the path when
# manually calling reload_path.
export ORIGINAL_PATH=$(echo $PATH | sed "s|$CUSTOM_PATH||")
else
export ORIGINAL_PATH=$PATH
fi
export CUSTOM_PATH=$(eval echo $((while read x; do echo -n "$x:"; done < $HOME/.path) 2> /dev/null || echo ""))
# CUSTOM_PATH ends with a trailing colon (:) so no need to provide it here.
export PATH=${CUSTOM_PATH}${ORIGINAL_PATH}
}
reload_path