dotenv: add ZSH_DOTENV_PROMPT config (#8624)

This commit is contained in:
Maxime Richard
2020-02-13 18:10:59 +01:00
committed by GitHub
parent a6df94d2c6
commit 634a50936a
2 changed files with 14 additions and 5 deletions

View File

@@ -1,10 +1,13 @@
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
if [ "$ZSH_DOTENV_PROMPT" != "false" ]; then
# confirm before sourcing 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
fi
# test .env syntax