1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-25 21:40:08 +00:00

wizard: print a message when aborted with ctrl-c

This commit is contained in:
romkatv 2020-05-14 11:24:53 +02:00
parent 574754eaf6
commit accbe293cb

View file

@ -23,6 +23,8 @@ else
function restore_screen() {} function restore_screen() {}
fi fi
local -i success=0
{ # always { # always
local -ri force local -ri force
@ -234,7 +236,10 @@ function show_cursor() {
function consume_input() { function consume_input() {
local key local key
while read -t0 key; do true; done while true; do
[[ -t 2 ]]
read -t0 -k key || break
done 2>/dev/null
} }
function quit() { function quit() {
@ -271,6 +276,7 @@ function quit() {
print -P " %2Fp10k%f %Bconfigure%b" print -P " %2Fp10k%f %Bconfigure%b"
print -P "" print -P ""
fi fi
function quit() {}
exit 1 exit 1
} }
@ -2051,7 +2057,10 @@ print -rP ""
flowing +c File feature requests and bug reports at "$(href https://github.com/romkatv/powerlevel10k/issues)" flowing +c File feature requests and bug reports at "$(href https://github.com/romkatv/powerlevel10k/issues)"
print -rP "" print -rP ""
success=1
} always { } always {
(( success )) || quit
consume_input consume_input
stty echo 2>/dev/null stty echo 2>/dev/null
show_cursor show_cursor