27f4e079329dabf8e7008b98c8bddf443116eb54

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

updater: use hardcoded color sequences instead of tput

Diff

 1diff --git a/tools/upgrade.sh b/tools/upgrade.sh
 2index 6d0a4663701afa7f0a477ac2a3002f4b61dd33e6..10f816080f2d88ee37f2ed5f67a42e7a1bf3c2ee 100644
 3--- a/tools/upgrade.sh
 4+++ b/tools/upgrade.sh
 5@@ -1,23 +1,20 @@
 6 
 7 # Use colors, but only if connected to a terminal, and that terminal
 8 # supports them.
 9-if which tput >/dev/null 2>&1; then
10-    ncolors=$(tput colors)
11-fi
12-if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
13-  RED="$(tput setaf 1)"
14-  GREEN="$(tput setaf 2)"
15-  YELLOW="$(tput setaf 3)"
16-  BLUE="$(tput setaf 4)"
17-  BOLD="$(tput bold)"
18-  NORMAL="$(tput sgr0)"
19+if [ -t 1 ]; then
20+  RED=$(printf '\033[31m')
21+  GREEN=$(printf '\033[32m')
22+  YELLOW=$(printf '\033[33m')
23+  BLUE=$(printf '\033[34m')
24+  BOLD=$(printf '\033[1m')
25+  RESET=$(printf '\033[m')
26 else
27   RED=""
28   GREEN=""
29   YELLOW=""
30   BLUE=""
31   BOLD=""
32-  NORMAL=""
33+  RESET=""
34 fi
35 
36 cd "$ZSH"
37@@ -51,10 +48,10 @@ then
38   printf '%s\n' '\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  '
39   printf '%s\n' '                        /____/                       '
40   printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
41-  printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
42-  printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
43+  printf "${BLUE}${BOLD}%s${RESET}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
44+  printf "${BLUE}${BOLD}%s${RESET}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
45 else
46-  printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
47+  printf "${RED}%s${RESET}\n" 'There was an error updating. Try again later?'
48 fi
49 
50 # Unset git-config values set just for the upgrade