feat(updater): check for typed input before automatically updating (#10830)
Diff
1diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
2index d3ad7582cff10144c14a8b934d3c70d7016a726e..149500aa9ef65de0131b482965c5f8cb1b3ebed1 100644
3--- a/tools/check_for_upgrade.sh
4+++ b/tools/check_for_upgrade.sh
5@@ -180,23 +180,17 @@ function has_typed_input() {
6 return
7 fi
8 9- # Don't ask for confirmation before updating if in auto mode
10- if [[ "$update_mode" = auto ]]; then
11- update_ohmyzsh
12- return $?
13- fi
14-
15- # If in reminder mode show reminder and exit
16- if [[ "$update_mode" = reminder ]]; then
17+ # If in reminder mode or user has typed input, show reminder and exit
18+ if [[ "$update_mode" = reminder ]] || has_typed_input; then
19+ printf '\r\e[0K' # move cursor to first column and clear whole line
20 echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`"
21 return 0
22 fi
2324- # If user has typed input, show reminder and exit
25- if has_typed_input; then
26- echo
27- echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`"
28- return 0
29+ # Don't ask for confirmation before updating if in auto mode
30+ if [[ "$update_mode" = auto ]]; then
31+ update_ohmyzsh
32+ return $?
33 fi
3435 # Ask for confirmation and only update on 'y', 'Y' or Enter