diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2022-02-19 17:12:23 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2022-02-19 17:12:23 -0600 |
commit | cae9a2b797649379e865e6bd73bc67e294e4ac77 (patch) | |
tree | 481419eff4bc761c3ca516704427394193473419 /tools/upgrade.sh | |
parent | 49edbf438ed690c76e6b2af80368c59404cf0167 (diff) | |
parent | 3427da4057dbe302933a7b5b19b4e23bfb9d0969 (diff) | |
download | zsh-cae9a2b797649379e865e6bd73bc67e294e4ac77.tar.gz zsh-cae9a2b797649379e865e6bd73bc67e294e4ac77.tar.bz2 zsh-cae9a2b797649379e865e6bd73bc67e294e4ac77.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'tools/upgrade.sh')
-rwxr-xr-x | tools/upgrade.sh | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 994ffe9c9..b6cb10b5a 100755 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -86,6 +86,24 @@ supports_hyperlinks() { return 1 } +# Adapted from code and information by Anton Kochkov (@XVilka) +# Source: https://gist.github.com/XVilka/8346728 +supports_truecolor() { + case "$COLORTERM" in + truecolor|24bit) return 0 ;; + esac + + case "$TERM" in + iterm |\ + tmux-truecolor |\ + linux-truecolor |\ + xterm-truecolor |\ + screen-truecolor) return 0 ;; + esac + + return 1 +} + fmt_link() { # $1: text, $2: url, $3: fallback mode if supports_hyperlinks; then @@ -107,15 +125,27 @@ setopt typeset_silent typeset -a RAINBOW if is_tty; then - RAINBOW=( - "$(printf '\033[38;5;196m')" - "$(printf '\033[38;5;202m')" - "$(printf '\033[38;5;226m')" - "$(printf '\033[38;5;082m')" - "$(printf '\033[38;5;021m')" - "$(printf '\033[38;5;093m')" - "$(printf '\033[38;5;163m')" - ) + if supports_truecolor; then + RAINBOW=( + "$(printf '\033[38;2;255;0;0m')" + "$(printf '\033[38;2;255;97;0m')" + "$(printf '\033[38;2;247;255;0m')" + "$(printf '\033[38;2;0;255;30m')" + "$(printf '\033[38;2;77;0;255m')" + "$(printf '\033[38;2;168;0;255m')" + "$(printf '\033[38;2;245;0;172m')" + ) + else + RAINBOW=( + "$(printf '\033[38;5;196m')" + "$(printf '\033[38;5;202m')" + "$(printf '\033[38;5;226m')" + "$(printf '\033[38;5;082m')" + "$(printf '\033[38;5;021m')" + "$(printf '\033[38;5;093m')" + "$(printf '\033[38;5;163m')" + ) + fi RED=$(printf '\033[31m') GREEN=$(printf '\033[32m') @@ -164,7 +194,7 @@ last_commit=$(git rev-parse "$branch") # Update Oh My Zsh printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh" -if git pull --rebase --stat $remote $branch; then +if LANG= git pull --quiet --rebase $remote $branch; then # Check if it was really updated or not if [[ "$(git rev-parse HEAD)" = "$last_commit" ]]; then message="Oh My Zsh is already at the latest version." |