mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
Issue #64: Now the theme detects on OSX which sed is to use.
This commit is contained in:
parent
754b648f37
commit
44db352e35
1 changed files with 43 additions and 13 deletions
|
@ -186,21 +186,51 @@ case $POWERLEVEL9K_MODE in
|
|||
;;
|
||||
esac
|
||||
|
||||
# OS detection for the `os_icon` segment
|
||||
case $(uname) in
|
||||
Darwin) OS_ICON=$APPLE_ICON ;;
|
||||
FreeBSD) OS_ICON=$FREEBSD_ICON ;;
|
||||
OpenBSD) OS_ICON=$FREEBSD_ICON ;;
|
||||
DragonFly) OS_ICON=$FREEBSD_ICON ;;
|
||||
Linux) OS_ICON=$LINUX_ICON ;;
|
||||
SunOS) OS_ICON=$SUNOS_ICON ;;
|
||||
*) OS_ICON='' ;;
|
||||
esac
|
||||
|
||||
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then
|
||||
VCS_BRANCH_ICON=''
|
||||
fi
|
||||
|
||||
# OS detection for the `os_icon` segment
|
||||
case $(uname) in
|
||||
Darwin)
|
||||
OS='OSX'
|
||||
OS_ICON=$APPLE_ICON
|
||||
;;
|
||||
FreeBSD)
|
||||
OS='BSD'
|
||||
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
|
||||
|
||||
# Determine the correct sed parameter.
|
||||
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
|
||||
|
||||
################################################################
|
||||
# color scheme
|
||||
################################################################
|
||||
|
@ -485,10 +515,10 @@ prompt_dir() {
|
|||
|
||||
case "$POWERLEVEL9K_SHORTEN_STRATEGY" in
|
||||
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)
|
||||
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"
|
||||
|
|
Loading…
Reference in a new issue