diff options
author | Mazin Ahmed <mazen160@users.noreply.github.com> | 2020-02-12 20:51:40 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-12 17:51:40 +0100 |
commit | e178ae39b41e554722c205d107a664dced1761b9 (patch) | |
tree | a0e8abb222c21f6d28d01da48c30f0d07646023a | |
parent | ebaccba6d837442bacf11d9b9d58bf66c18e858d (diff) | |
download | zsh-e178ae39b41e554722c205d107a664dced1761b9.tar.gz zsh-e178ae39b41e554722c205d107a664dced1761b9.tar.bz2 zsh-e178ae39b41e554722c205d107a664dced1761b9.zip |
dotenv: prompt before executing dotenv file (#8606)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
-rw-r--r-- | plugins/dotenv/dotenv.plugin.zsh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh index 89763d0ee..d4a6db8f8 100644 --- a/plugins/dotenv/dotenv.plugin.zsh +++ b/plugins/dotenv/dotenv.plugin.zsh @@ -1,5 +1,12 @@ source_env() { if [[ -f $ZSH_DOTENV_FILE ]]; then + # confirm before sourcing .env file + local confirmation + echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) " + if read -k 1 confirmation && [[ $confirmation = [nN] ]]; then + return + fi + # test .env syntax zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2 |