Issue #64: Now the theme detects on OSX which sed is to use.

pull/22/head
Dominik Ritter 9 years ago
parent 754b648f37
commit 44db352e35

@ -186,19 +186,49 @@ case $POWERLEVEL9K_MODE in
;; ;;
esac esac
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then
VCS_BRANCH_ICON=''
fi
# OS detection for the `os_icon` segment # OS detection for the `os_icon` segment
case $(uname) in case $(uname) in
Darwin) OS_ICON=$APPLE_ICON ;; Darwin)
FreeBSD) OS_ICON=$FREEBSD_ICON ;; OS='OSX'
OpenBSD) OS_ICON=$FREEBSD_ICON ;; OS_ICON=$APPLE_ICON
DragonFly) OS_ICON=$FREEBSD_ICON ;; ;;
Linux) OS_ICON=$LINUX_ICON ;; FreeBSD)
SunOS) OS_ICON=$SUNOS_ICON ;; OS='BSD'
*) OS_ICON='' ;; OS_ICON=$FREEBSD_ICON
;;
OpenBSD)
OS='BSD'
OS_ICON=$FREEBSD_ICON
;;
DragonFly)
OS='BSD'
OS_ICON=$FREEBSD_ICON
;;
Linux)
OS='Linux'
OS_ICON=$LINUX_ICON
;;
SunOS)
OS='Solaris'
OS_ICON=$SUNOS_ICON
;;
*)
OS=''
OS_ICON=''
;;
esac esac
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then # Determine the correct sed parameter.
VCS_BRANCH_ICON='' SED_EXTENDED_REGEX_PARAMETER="-r"
if [[ "$OS" == 'OSX' ]]; then
local IS_BSD_SED=$(sed --version &>> /dev/null || echo "BSD sed")
if [[ -n "$IS_BSD_SED" ]]; then
SED_EXTENDED_REGEX_PARAMETER="-E"
fi
fi fi
################################################################ ################################################################
@ -485,10 +515,10 @@ prompt_dir() {
case "$POWERLEVEL9K_SHORTEN_STRATEGY" in case "$POWERLEVEL9K_SHORTEN_STRATEGY" in
truncate_middle) truncate_middle)
current_path=$(pwd | sed -e "s,^$HOME,~," | sed -E "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1\.\.\2\//g") current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1\.\.\2\//g")
;; ;;
truncate_from_right) truncate_from_right)
current_path=$(pwd | sed -e "s,^$HOME,~," | sed -E "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1..\//g") current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1..\//g")
;; ;;
*) *)
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c" current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c"

Loading…
Cancel
Save