diff --git a/lib/functions.zsh b/lib/functions.zsh index 17f5f9cbf..15bb8e07c 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -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 +}