fix(updater): don't show changelog when running unattended update (#9495)

Fixes #9495
This commit is contained in:
Marc Cornellà 2020-12-07 19:53:07 +01:00
parent fa1911f89e
commit 5a888ff4ac
4 changed files with 15 additions and 7 deletions

View file

@ -376,13 +376,19 @@ function _omz::theme::use {
function _omz::update { function _omz::update {
# Run update script # Run update script
env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" if [[ "$1" != --unattended ]]; then
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
else
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
fi
local ret=$? local ret=$?
# Update last updated file # Update last updated file
zmodload zsh/datetime zmodload zsh/datetime
echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update" echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update"
# Remove update lock if it exists # Remove update lock if it exists
command rm -rf "$ZSH/log/update.lock" command rm -rf "$ZSH/log/update.lock"
# Restart the zsh session # Restart the zsh session
if [[ $ret -eq 0 && "$1" != --unattended ]]; then if [[ $ret -eq 0 && "$1" != --unattended ]]; then
# Check whether to run a login shell # Check whether to run a login shell

View file

@ -14,7 +14,7 @@ function upgrade_oh_my_zsh() {
fi fi
# Run update script # Run update script
env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
local ret=$? local ret=$?
# Update last updated file # Update last updated file
zmodload zsh/datetime zmodload zsh/datetime

View file

@ -24,7 +24,7 @@ function update_last_updated_file() {
} }
function update_ohmyzsh() { function update_ohmyzsh() {
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
update_last_updated_file update_last_updated_file
} }

View file

@ -70,12 +70,14 @@ if git pull --rebase --stat origin master; then
message="Hooray! Oh My Zsh has been updated!" message="Hooray! Oh My Zsh has been updated!"
# Display changelog with less if available, otherwise just print it to the terminal # Display changelog with less if available, otherwise just print it to the terminal
if [[ "$1" = --interactive ]]; then
if (( $+commands[less] )); then if (( $+commands[less] )); then
"$ZSH/tools/changelog.sh" HEAD "$last_commit" --text | command less -R "$ZSH/tools/changelog.sh" HEAD "$last_commit" --text | LESS= command less -R
else else
"$ZSH/tools/changelog.sh" HEAD "$last_commit" "$ZSH/tools/changelog.sh" HEAD "$last_commit"
fi fi
fi 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