Added dot-env plugin

Dot-env is a cross-platform, cascading Zsh environment system for those who work on different hardware and OS environments.

See: https://github.com/midwire/.env
This commit is contained in:
Chris Blackburn 2012-01-21 19:12:38 -06:00
commit ae2db75f3e
20 changed files with 629 additions and 0 deletions

View file

@ -0,0 +1,53 @@
# Skip all this for non-interactive shells
[[ -z "$PS1" ]] && return
export DOT_ENV_PATH="$( cd "$( dirname "${0}" )" && pwd )"
OS=`uname`
if [[ $OS == 'Darwin' ]]; then
x=1
elif [[ $OS == 'SunOS' ]]; then
x=1
elif [[ $OS == 'Linux' ]]; then
x=1
else
echo "Sorry, no portable environment support for your platform: '$OS'"
exit 1
fi
OS_DIR=$DOT_ENV_PATH/os/$OS
# Make sure globals are sourced before OS specifics
if [[ "$SHLVL" == "1" ]]; then
echo "Sourcing Global Environment"
fi
for i in $DOT_ENV_PATH/global/global_*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
# Now source OS specifics
if [[ "$SHLVL" == "1" ]]; then
echo "Sourcing $OS Environment"
fi
for i in $OS_DIR/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
# Source Host specifics if there are any for the current host
if [[ ! -z "$HOST" ]]; then
HOST_DIR=$DOT_ENV_PATH/host/`hostname`
if [[ "$SHLVL" == "1" ]]; then
echo "Sourcing '$HOST' Environment"
fi
for i in $HOST_DIR/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
fi
unset i