upgrade.sh 1.4 KB

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