mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
os_icon: Combining OS detection and icon setting into one case statement
This commit is contained in:
parent
fb9dbe86f7
commit
4ef5294d0b
1 changed files with 10 additions and 18 deletions
|
@ -44,16 +44,6 @@
|
|||
#zstyle ':vcs_info:*+*:*' debug true
|
||||
#set -o xtrace
|
||||
|
||||
# OS detection, default to Linux
|
||||
case $(uname) in
|
||||
FreeBSD) OS=FreeBSD ;;
|
||||
DragonFly) OS=FreeBSD ;;
|
||||
OpenBSD) OS=OpenBSD ;;
|
||||
Darwin) OS=Darwin ;;
|
||||
SunOS) OS=SunOS ;;
|
||||
*) OS=Linux ;;
|
||||
esac
|
||||
|
||||
# The `CURRENT_BG` variable is used to remember what the last BG color used was
|
||||
# when building the left-hand prompt. Because the RPROMPT is created from
|
||||
# right-left but reads the opposite, this isn't necessary for the other side.
|
||||
|
@ -196,6 +186,15 @@ 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 ;;
|
||||
Linux) OS_ICON=$LINUX_ICON ;;
|
||||
SunOS) OS_ICON=$SUNOS_ICON ;;
|
||||
*) OS_ICON='' ;;
|
||||
esac
|
||||
|
||||
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then
|
||||
VCS_BRANCH_ICON=''
|
||||
fi
|
||||
|
@ -525,14 +524,7 @@ prompt_node_version() {
|
|||
|
||||
# print a little OS icon
|
||||
prompt_os_icon() {
|
||||
case "$OS" in
|
||||
"Darwin") OS_ICON=$APPLE_ICON ;;
|
||||
"FreeBSD") OS_ICON=$FREEBSD_ICON ;;
|
||||
"Linux") OS_ICON=$LINUX_ICON ;;
|
||||
"SunOS") OS_ICON=$SUNOS_ICON ;;
|
||||
*) OS_ICON='' ;;
|
||||
esac
|
||||
$1_prompt_segment "$0" "008" "241" "$OS_ICON"
|
||||
$1_prompt_segment "$0" "008" "255" "$OS_ICON"
|
||||
}
|
||||
|
||||
# rbenv information
|
||||
|
|
Loading…
Reference in a new issue