upgrade.sh 1.3 KB

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