0
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-09-19 04:01:21 +02:00
ohmyzsh/plugins/dotenv/dotenv.plugin.zsh

20 lines
312 B
Bash
Raw Normal View History

2016-12-14 17:49:08 +01:00
source_env() {
if [[ -f .env ]]; then
# test .env syntax
zsh -fn .env || echo 'dotenv: error when sourcing `.env` file' >&2
if [[ -o a ]]; then
source .env
else
set -a
source .env
set +a
fi
2016-12-14 17:49:08 +01:00
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd source_env
source_env