2015-07-07 08:18:32 +08:00
|
|
|
|
|
|
|
# Use colors, but only if connected to a terminal, and that terminal
|
|
|
|
# supports them.
|
2015-10-15 21:37:30 +08:00
|
|
|
if which tput >/dev/null 2>&1; then
|
2015-09-22 22:46:22 +08:00
|
|
|
ncolors=$(tput colors)
|
|
|
|
fi
|
2015-07-07 08:18:32 +08:00
|
|
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
2015-09-01 01:29:54 +08:00
|
|
|
RED="$(tput setaf 1)"
|
2015-07-07 08:18:32 +08:00
|
|
|
GREEN="$(tput setaf 2)"
|
|
|
|
YELLOW="$(tput setaf 3)"
|
|
|
|
BLUE="$(tput setaf 4)"
|
|
|
|
BOLD="$(tput bold)"
|
|
|
|
NORMAL="$(tput sgr0)"
|
|
|
|
else
|
|
|
|
RED=""
|
|
|
|
GREEN=""
|
|
|
|
YELLOW=""
|
|
|
|
BLUE=""
|
|
|
|
BOLD=""
|
|
|
|
NORMAL=""
|
|
|
|
fi
|
|
|
|
|
2013-03-11 03:36:39 +08:00
|
|
|
cd "$ZSH"
|
2019-10-21 22:42:06 +08:00
|
|
|
|
|
|
|
# Set git-config values known to fix git errors
|
|
|
|
# Line endings (#4069)
|
|
|
|
git config core.eol lf
|
|
|
|
git config core.autocrlf false
|
|
|
|
# zeroPaddedFilemode fsck errors (#4963)
|
|
|
|
git config fsck.zeroPaddedFilemode ignore
|
|
|
|
git config fetch.fsck.zeroPaddedFilemode ignore
|
|
|
|
git config receive.fsck.zeroPaddedFilemode ignore
|
|
|
|
|
2019-11-21 09:26:18 +08:00
|
|
|
# Update upstream remote to ohmyzsh org
|
|
|
|
remote=$(git remote -v | awk '/https:\/\/github\.com\/robbyrussell\/oh-my-zsh\.git/{ print $1; exit }')
|
2019-11-22 02:10:30 +08:00
|
|
|
if [ -n "$remote" ]; then
|
2019-11-21 09:26:18 +08:00
|
|
|
git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
|
|
|
|
fi
|
|
|
|
|
2019-10-21 22:42:06 +08:00
|
|
|
printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
|
2020-02-28 00:06:20 +08:00
|
|
|
if git pull --rebase --autostash --stat origin master
|
2012-01-15 14:49:52 +08:00
|
|
|
then
|
2015-07-07 08:18:32 +08:00
|
|
|
printf '%s' "$GREEN"
|
|
|
|
printf '%s\n' ' __ __ '
|
|
|
|
printf '%s\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
|
|
|
|
printf '%s\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
|
|
|
|
printf '%s\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
|
|
|
|
printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
|
|
|
|
printf '%s\n' ' /____/ '
|
|
|
|
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
|
2015-08-18 15:01:21 +08:00
|
|
|
printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
|
2019-11-09 19:49:17 +08:00
|
|
|
printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
|
2012-01-15 14:49:52 +08:00
|
|
|
else
|
2015-07-07 08:18:32 +08:00
|
|
|
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
|
2012-01-15 14:49:52 +08:00
|
|
|
fi
|