merge from upstream

This commit is contained in:
abc 2023-04-07 16:01:57 +08:00
commit 64603fdc86
229 changed files with 5826 additions and 2389 deletions

View file

@ -1,5 +1,7 @@
#!/usr/bin/env zsh
local ret=0 # exit code
# Protect against running with shells other than zsh
if [ -z "$ZSH_VERSION" ]; then
exec zsh "$0" "$@"
@ -12,6 +14,23 @@ esac
cd "$ZSH"
verbose_mode="default"
interactive=false
while getopts "v:i" opt; do
case $opt in
v)
if [[ $OPTARG == default || $OPTARG == minimal || $OPTARG == silent ]]; then
verbose_mode=$OPTARG
else
echo "[oh-my-zsh] update verbosity '$OPTARG' is not valid"
echo "[oh-my-zsh] valid options are 'default', 'minimal' and 'silent'"
fi
;;
i) interactive=true ;;
esac
done
# Use colors, but only if connected to a terminal
# and that terminal supports them.
@ -78,11 +97,17 @@ supports_hyperlinks() {
return 0
fi
# Windows Terminal or Konsole also support hyperlinks
if [ -n "$WT_SESSION" ] || [ -n "$KONSOLE_VERSION" ]; then
# Windows Terminal also supports hyperlinks
if [ -n "$WT_SESSION" ]; then
return 0
fi
# Konsole supports hyperlinks, but it's an opt-in setting that can't be detected
# https://github.com/ohmyzsh/ohmyzsh/issues/10964
# if [ -n "$KONSOLE_VERSION" ]; then
# return 0
# fi
return 1
}
@ -107,7 +132,7 @@ supports_truecolor() {
fmt_link() {
# $1: text, $2: url, $3: fallback mode
if supports_hyperlinks; then
printf '\033]8;;%s\a%s\033]8;;\a\n' "$2" "$1"
printf '\033]8;;%s\033\\%s\033]8;;\033\\\n' "$2" "$1"
return
fi
@ -197,7 +222,9 @@ git checkout -q "$branch" -- || exit 1
last_commit=$(git rev-parse "$branch")
# Update Oh My Zsh
printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh"
if [[ $verbose_mode != silent ]]; then
printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh"
fi
if LANG= git pull --quiet --rebase $remote $branch; then
# Check if it was really updated or not
if [[ "$(git rev-parse HEAD)" = "$last_commit" ]]; then
@ -209,24 +236,30 @@ if LANG= git pull --quiet --rebase $remote $branch; then
git config oh-my-zsh.lastVersion "$last_commit"
# Print changelog to the terminal
if [[ "$1" = --interactive ]]; then
if [[ $interactive == true && $verbose_mode == default ]]; then
"$ZSH/tools/changelog.sh" HEAD "$last_commit"
fi
printf "${BLUE}%s \`${BOLD}%s${RESET}${BLUE}\`${RESET}\n" "You can see the changelog with" "omz changelog"
if [[ $verbose_mode != silent ]]; then
printf "${BLUE}%s \`${BOLD}%s${RESET}${BLUE}\`${RESET}\n" "You can see the changelog with" "omz changelog"
fi
fi
printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET
printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET
printf '%s / __ \\%s/ __ \\ %s / __ `__ \\%s/ / / / %s /_ / %s/ ___/%s __ \\ %s\n' $RAINBOW $RESET
printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET
printf '%s\\____/%s_/ /_/ %s /_/ /_/ /_/%s\\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET
printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET
printf '\n'
printf "${BLUE}%s${RESET}\n\n" "$message"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "To keep up with the latest news and updates, follow us on Twitter:" "$(fmt_link @ohmyzsh https://twitter.com/ohmyzsh)"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "Want to get involved in the community? Join our Discord:" "$(fmt_link "Discord server" https://discord.gg/ohmyzsh)"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "Get your Oh My Zsh swag at:" "$(fmt_link "Planet Argon Shop" https://shop.planetargon.com/collections/oh-my-zsh)"
if [[ $verbose_mode == default ]]; then
printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET
printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET
printf '%s / __ \\%s/ __ \\ %s / __ `__ \\%s/ / / / %s /_ / %s/ ___/%s __ \\ %s\n' $RAINBOW $RESET
printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET
printf '%s\\____/%s_/ /_/ %s /_/ /_/ /_/%s\\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET
printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET
printf '\n'
printf "${BLUE}%s${RESET}\n\n" "$message"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "To keep up with the latest news and updates, follow us on Twitter:" "$(fmt_link @ohmyzsh https://twitter.com/ohmyzsh)"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "Want to get involved in the community? Join our Discord:" "$(fmt_link "Discord server" https://discord.gg/ohmyzsh)"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "Get your Oh My Zsh swag at:" "$(fmt_link "Planet Argon Shop" https://shop.planetargon.com/collections/oh-my-zsh)"
elif [[ $verbose_mode == minimal ]]; then
printf "${BLUE}%s${RESET}\n" "$message"
fi
else
ret=$?
printf "${RED}%s${RESET}\n" 'There was an error updating. Try again later?'