Merge remote-tracking branch 'sambadevi/feature/etc-option-in-dir-segment' into staging_065

This commit is contained in:
Dominik Ritter 2018-06-07 01:27:15 +02:00
commit 47e2aed4b2
2 changed files with 9 additions and 1 deletions

View file

@ -915,10 +915,13 @@ prompt_dir() {
"HOME" "HOME_ICON"
"HOME_SUBFOLDER" "HOME_SUB_ICON"
"NOT_WRITABLE" "LOCK_ICON"
"ETC" "ETC_ICON"
)
local state_path="$(print -P '%~')"
local current_state="DEFAULT"
if [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == true && ! -w "$PWD" ]]; then
if [[ $state_path == '/etc'* ]]; then
current_state='ETC'
elif [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == true && ! -w "$PWD" ]]; then
current_state="NOT_WRITABLE"
elif [[ $state_path == '~' ]]; then
current_state="HOME"