mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-27 08:48:56 +01:00
c781d708da
Fixes #6337
20 lines
312 B
Bash
20 lines
312 B
Bash
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
|
|
fi
|
|
}
|
|
|
|
autoload -U add-zsh-hook
|
|
add-zsh-hook chpwd source_env
|
|
|
|
source_env
|