2015-07-07 08:18:32 +08:00
|
|
|
# Use colors, but only if connected to a terminal, and that terminal
|
|
|
|
# supports them.
|
2020-03-11 21:24:04 +08:00
|
|
|
if [ -t 1 ]; then
|
2020-05-18 17:23:28 +08:00
|
|
|
RB_RED=$(printf '\033[38;5;196m')
|
|
|
|
RB_ORANGE=$(printf '\033[38;5;202m')
|
|
|
|
RB_YELLOW=$(printf '\033[38;5;226m')
|
|
|
|
RB_GREEN=$(printf '\033[38;5;082m')
|
|
|
|
RB_BLUE=$(printf '\033[38;5;021m')
|
|
|
|
RB_INDIGO=$(printf '\033[38;5;093m')
|
|
|
|
RB_VIOLET=$(printf '\033[38;5;163m')
|
|
|
|
|
2020-03-11 21:24:04 +08:00
|
|
|
RED=$(printf '\033[31m')
|
|
|
|
GREEN=$(printf '\033[32m')
|
|
|
|
YELLOW=$(printf '\033[33m')
|
|
|
|
BLUE=$(printf '\033[34m')
|
|
|
|
BOLD=$(printf '\033[1m')
|
|
|
|
RESET=$(printf '\033[m')
|
2015-07-07 08:18:32 +08:00
|
|
|
else
|
2020-05-18 17:23:28 +08:00
|
|
|
RB_RED=""
|
|
|
|
RB_ORANGE=""
|
|
|
|
RB_YELLOW=""
|
|
|
|
RB_GREEN=""
|
|
|
|
RB_BLUE=""
|
|
|
|
RB_INDIGO=""
|
|
|
|
RB_VIOLET=""
|
|
|
|
|
2015-07-07 08:18:32 +08:00
|
|
|
RED=""
|
|
|
|
GREEN=""
|
|
|
|
YELLOW=""
|
|
|
|
BLUE=""
|
|
|
|
BOLD=""
|
2020-03-11 21:24:04 +08:00
|
|
|
RESET=""
|
2015-07-07 08:18:32 +08:00
|
|
|
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
|
2020-03-11 21:17:41 +08:00
|
|
|
# autostash on rebase (#7172)
|
|
|
|
resetAutoStash=$(git config --bool rebase.autoStash 2>&1)
|
|
|
|
git config rebase.autoStash true
|
2019-10-21 22:42:06 +08:00
|
|
|
|
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
|
|
|
|
|
2020-05-19 20:47:30 +08:00
|
|
|
printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh"
|
2020-03-11 21:17:41 +08:00
|
|
|
if git pull --rebase --stat origin master
|
2012-01-15 14:49:52 +08:00
|
|
|
then
|
2020-05-18 17:23:28 +08:00
|
|
|
printf '%s %s__ %s %s %s %s %s__ %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
|
|
|
|
printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
|
|
|
|
printf '%s / __ \%s/ __ \ %s / __ `__ \%s/ / / / %s /_ / %s/ ___/%s __ \ %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
|
|
|
|
printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
|
|
|
|
printf '%s\____/%s_/ /_/ %s /_/ /_/ /_/%s\__, / %s /___/%s____/%s_/ /_/ %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
|
|
|
|
printf '%s %s %s %s /____/ %s %s %s %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
|
2015-07-07 08:18:32 +08:00
|
|
|
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
|
2020-03-11 21:24:04 +08:00
|
|
|
printf "${BLUE}${BOLD}%s${RESET}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
|
|
|
|
printf "${BLUE}${BOLD}%s${RESET}\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
|
2020-03-11 21:24:04 +08:00
|
|
|
printf "${RED}%s${RESET}\n" 'There was an error updating. Try again later?'
|
2012-01-15 14:49:52 +08:00
|
|
|
fi
|
2020-03-11 21:17:41 +08:00
|
|
|
|
|
|
|
# Unset git-config values set just for the upgrade
|
|
|
|
case "$resetAutoStash" in
|
|
|
|
"") git config --unset rebase.autoStash ;;
|
|
|
|
*) git config rebase.autoStash "$resetAutoStash" ;;
|
|
|
|
esac
|