diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2022-02-19 17:12:23 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2022-02-19 17:12:23 -0600 |
commit | cae9a2b797649379e865e6bd73bc67e294e4ac77 (patch) | |
tree | 481419eff4bc761c3ca516704427394193473419 /plugins/dotenv | |
parent | 49edbf438ed690c76e6b2af80368c59404cf0167 (diff) | |
parent | 3427da4057dbe302933a7b5b19b4e23bfb9d0969 (diff) | |
download | zsh-cae9a2b797649379e865e6bd73bc67e294e4ac77.tar.gz zsh-cae9a2b797649379e865e6bd73bc67e294e4ac77.tar.bz2 zsh-cae9a2b797649379e865e6bd73bc67e294e4ac77.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'plugins/dotenv')
-rw-r--r-- | plugins/dotenv/dotenv.plugin.zsh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh index 40ec5c46f..46cd4b10a 100644 --- a/plugins/dotenv/dotenv.plugin.zsh +++ b/plugins/dotenv/dotenv.plugin.zsh @@ -23,12 +23,12 @@ source_env() { touch "$ZSH_DOTENV_DISALLOWED_LIST" # early return if disallowed - if command grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then + if command grep -Fx -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then return fi # check if current directory's .env file is allowed or ask for confirmation - if ! command grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then + if ! command grep -Fx -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then # get cursor column and print new line before prompt if not at line beginning local column echo -ne "\e[6n" > /dev/tty @@ -52,7 +52,10 @@ source_env() { fi # test .env syntax - zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2 + zsh -fn $ZSH_DOTENV_FILE || { + echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2 + return 1 + } setopt localoptions allexport source $ZSH_DOTENV_FILE |