mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
fix(dotenv): expect explicit yes before loading .env file
This commit is contained in:
parent
76ffd9e22a
commit
139bc2b5a1
1 changed files with 3 additions and 3 deletions
|
|
@ -37,16 +37,16 @@ source_env() {
|
||||||
[[ $column -eq 1 ]] || echo
|
[[ $column -eq 1 ]] || echo
|
||||||
|
|
||||||
# print same-line prompt and output newline character if necessary
|
# print same-line prompt and output newline character if necessary
|
||||||
echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways/n[e]ver) "
|
echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([y]es/[N]o/[a]lways/n[e]ver) "
|
||||||
read -k 1 confirmation
|
read -k 1 confirmation
|
||||||
[[ "$confirmation" = $'\n' ]] || echo
|
[[ "$confirmation" = $'\n' ]] || echo
|
||||||
|
|
||||||
# check input
|
# check input
|
||||||
case "$confirmation" in
|
case "$confirmation" in
|
||||||
[nN]) return ;;
|
[yY]) ;;
|
||||||
[aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
|
[aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
|
||||||
[eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;;
|
[eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;;
|
||||||
*) ;; # interpret anything else as a yes
|
*) return ;; # interpret anything else as a no
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue