upgrade.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Use colors, but only if connected to a terminal, and that terminal
  2. # supports them.
  3. if which tput >/dev/null 2>&1; then
  4. ncolors=$(tput colors)
  5. fi
  6. if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
  7. RED="$(tput setaf 1)"
  8. GREEN="$(tput setaf 2)"
  9. YELLOW="$(tput setaf 3)"
  10. BLUE="$(tput setaf 4)"
  11. BOLD="$(tput bold)"
  12. NORMAL="$(tput sgr0)"
  13. else
  14. RED=""
  15. GREEN=""
  16. YELLOW=""
  17. BLUE=""
  18. BOLD=""
  19. NORMAL=""
  20. fi
  21. printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
  22. cd "$ZSH"
  23. if git pull --rebase --stat origin master
  24. then
  25. printf '%s' "$GREEN"
  26. printf '%s\n' ' __ __ '
  27. printf '%s\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
  28. printf '%s\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
  29. printf '%s\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
  30. printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
  31. printf '%s\n' ' /____/ '
  32. printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
  33. printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
  34. printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: http://shop.planetargon.com/"
  35. else
  36. printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
  37. fi