diff --git a/bash/.bashrc b/bash/.bashrc index 7497f46..17f9e4f 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -12,9 +12,21 @@ no_color="\001$(tput sgr0)\002" export PS1="${green}\$${no_color} " +export DIRENV_PS1="${red}\$${no_color} " if [ "${HOSTNAME}" != "crypt" ] && [ "${HOSTNAME}" != "tomb" ] || [ "${SSH_TTY}" != "" ]; then PS1="${PS1}${blue}${HOSTNAME} ${PS1}" + DIRENV_PS1="${PS1}${blue}${HOSTNAME} ${PS1}" fi +export ORIG_PS1=${PS1} + +update_prompt() { + if direnv status | grep -iq 'RC allowed true'; then + PS1=${DIRENV_PS1} + else + PS1=${ORIG_PS1} + fi +} +PROMPT_COMMAND="update_prompt; $PROMPT_COMMAND" # Continuation Prompt: "> " in cyan export PS2="${cyan}>${no_color} "