summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2022-04-10 10:20:51 +0200
committerGitHub <noreply@github.com>2022-04-10 10:20:51 +0200
commit846f417eb8ec76e8eee70000e289b8b81f19d480 (patch)
treeee73087ce744e4894f81e2a1335700fbc05a6dbd
parentfcceeb666452c5a41b786f3cde9c8635ddde5448 (diff)
downloadzsh-846f417eb8ec76e8eee70000e289b8b81f19d480.tar.gz
zsh-846f417eb8ec76e8eee70000e289b8b81f19d480.tar.bz2
zsh-846f417eb8ec76e8eee70000e289b8b81f19d480.zip
feat(updater): check for typed input before automatically updating (#10830)
-rw-r--r--tools/check_for_upgrade.sh20
1 files changed, 7 insertions, 13 deletions
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index d3ad7582c..149500aa9 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -180,23 +180,17 @@ function has_typed_input() {
return
fi
- # Don't ask for confirmation before updating if in auto mode
- if [[ "$update_mode" = auto ]]; then
- update_ohmyzsh
- return $?
- fi
-
- # If in reminder mode show reminder and exit
- if [[ "$update_mode" = reminder ]]; then
+ # If in reminder mode or user has typed input, show reminder and exit
+ if [[ "$update_mode" = reminder ]] || has_typed_input; then
+ printf '\r\e[0K' # move cursor to first column and clear whole line
echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`"
return 0
fi
- # If user has typed input, show reminder and exit
- if has_typed_input; then
- echo
- echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`"
- return 0
+ # Don't ask for confirmation before updating if in auto mode
+ if [[ "$update_mode" = auto ]]; then
+ update_ohmyzsh
+ return $?
fi
# Ask for confirmation and only update on 'y', 'Y' or Enter