Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
f0f42828
Unverified
Commit
f0f42828
authored
Feb 07, 2022
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(updater): do not update when user already typed some characters (#9699)
Fixes #9699
parent
1e26ad11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
16 deletions
+25
-16
check_for_upgrade.sh
tools/check_for_upgrade.sh
+25
-16
No files found.
tools/check_for_upgrade.sh
View file @
f0f42828
...
...
@@ -146,26 +146,35 @@ function update_ohmyzsh() {
return
fi
#
Ask for confirmation before updating unless
in auto mode
#
Don't ask for confirmation before updating if
in auto mode
if
[[
"
$update_mode
"
=
auto
]]
;
then
update_ohmyzsh
elif
[[
"
$update_mode
"
=
reminder
]]
;
then
return
$?
fi
# If in reminder mode show reminder and exit
if
[[
"
$update_mode
"
=
reminder
]]
;
then
echo
"[oh-my-zsh] It's time to update! You can do that by running
\`
omz update
\`
"
else
# input sink to swallow all characters typed before the prompt
# and add a newline if there wasn't one after characters typed
while
read
-t
-k
1 option
;
do
true
;
done
[[
"
$option
"
!=
(
$'
\n
'
|
""
)
]]
&&
echo
return
0
fi
# If user has typed input, show reminder and exit
if
read
-t
-k
1
;
then
echo
echo
"[oh-my-zsh] It's time to update! You can do that by running
\`
omz update
\`
"
return
0
fi
# Ask for confirmation and only update on 'y', 'Y' or Enter
# Otherwise just show a reminder for how to update
echo
-n
"[oh-my-zsh] Would you like to update? [Y/n] "
read
-r
-k
1 option
[[
"
$option
"
!=
$'
\n
'
]]
&&
echo
[[
"
$option
"
=
$'
\n
'
]]
||
echo
case
"
$option
"
in
[
yY
$'
\n
'
]
)
update_ohmyzsh
;;
[
nN]
)
update_last_updated_file
;
&
*
)
echo
"[oh-my-zsh] You can update manually by running
\`
omz update
\`
"
;;
esac
fi
}
unset
update_mode
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment