summaryrefslogtreecommitdiff
path: root/plugins/dotenv/dotenv.plugin.zsh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2019-09-11 18:19:51 -0600
committerTuowen Zhao <ztuowen@gmail.com>2019-09-11 18:19:51 -0600
commitd676c1553254309beca5bb9a8edb43fbe09a7169 (patch)
treed0bb04b6487e6fedbb2b2370a894fccd19d4c567 /plugins/dotenv/dotenv.plugin.zsh
parentfb141c2257f648cd29b64cbd3f2ca9123f6e427f (diff)
parentddd359dd668f448856438304bedfe952d1749efd (diff)
downloadzsh-d676c1553254309beca5bb9a8edb43fbe09a7169.tar.gz
zsh-d676c1553254309beca5bb9a8edb43fbe09a7169.tar.bz2
zsh-d676c1553254309beca5bb9a8edb43fbe09a7169.zip
Merge remote-tracking branch 'orig/master'
Diffstat (limited to 'plugins/dotenv/dotenv.plugin.zsh')
-rw-r--r--plugins/dotenv/dotenv.plugin.zsh12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
index b701b5596..89763d0ee 100644
--- a/plugins/dotenv/dotenv.plugin.zsh
+++ b/plugins/dotenv/dotenv.plugin.zsh
@@ -1,13 +1,13 @@
source_env() {
- if [[ -f .env ]]; then
+ if [[ -f $ZSH_DOTENV_FILE ]]; then
# test .env syntax
- zsh -fn .env || echo 'dotenv: error when sourcing `.env` file' >&2
+ zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
if [[ -o a ]]; then
- source .env
+ source $ZSH_DOTENV_FILE
else
set -a
- source .env
+ source $ZSH_DOTENV_FILE
set +a
fi
fi
@@ -16,4 +16,8 @@ source_env() {
autoload -U add-zsh-hook
add-zsh-hook chpwd source_env
+if [[ -z $ZSH_DOTENV_FILE ]]; then
+ ZSH_DOTENV_FILE=.env
+fi
+
source_env