This adds two functions to modify your PATH.

Both functions check to see if the directories that will be inserted
into your PATH are currently on the system.  This is good for having
one zshrc file and deploying it to myltiple enviroments.
This commit is contained in:
Jack Thorne 2014-11-05 16:15:03 -08:00
commit 086e78b68b

View file

@ -73,3 +73,27 @@ function env_default() {
env | grep -q "^$1=" && return 0
export "$1=$2" && return 3
}
#
# Prepends the PATH varible with the input path
#
# Arguments:
# 1. path - The path that will be prepened
# Return value:
# 0 if PATH is exported to ENV
#
function prepend_path() {
[[ -d "$1" ]] && export PATH="$1":$PATH && return 0
}
#
# Prepends the PATH varible with the input path
#
# Arguments:
# 1. path - The path that will be prepened
# Return value:
# 0 if PATH is exported to ENV
#
function postpend_path() {
[[ -d "$1" ]] && export PATH=$PATH:"$1" && return 0
}