diff options
author | Marc Cornellà <marc.cornella@live.com> | 2020-02-27 22:55:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 22:55:30 +0100 |
commit | 18ee5dffdc57bb9219ee96b40da006704ac37df1 (patch) | |
tree | e1fe420cf18fa7a916d5d43c408c6f92ed33b62d /plugins/dotenv/dotenv.plugin.zsh | |
parent | d81cd753e0b3a845e8f3549da245dbad102a6e4c (diff) | |
parent | 368198b7616eb69b396de86d9ec4ff0f35bd72f0 (diff) | |
download | zsh-18ee5dffdc57bb9219ee96b40da006704ac37df1.tar.gz zsh-18ee5dffdc57bb9219ee96b40da006704ac37df1.tar.bz2 zsh-18ee5dffdc57bb9219ee96b40da006704ac37df1.zip |
Merge branch 'master' into clipboard
Diffstat (limited to 'plugins/dotenv/dotenv.plugin.zsh')
-rw-r--r-- | plugins/dotenv/dotenv.plugin.zsh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh index 89763d0ee..54036bee3 100644 --- a/plugins/dotenv/dotenv.plugin.zsh +++ b/plugins/dotenv/dotenv.plugin.zsh @@ -1,5 +1,17 @@ source_env() { if [[ -f $ZSH_DOTENV_FILE ]]; then + if [ "$ZSH_DOTENV_PROMPT" != "false" ]; then + # confirm before sourcing file + local confirmation + # print same-line prompt and output newline character if necessary + echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) " + read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo + # only bail out if confirmation character is n + if [[ "$confirmation" = [nN] ]]; then + return + fi + fi + # test .env syntax zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2 |