Show installation output in alternate screen
This commit is contained in:
parent
6cc89416ce
commit
832534aac9
@ -7,7 +7,12 @@ die() { printf "\033[31m%s\033[m\n\r" "$*" > /dev/stderr; exit 1; }
|
|||||||
|
|
||||||
delete_lock_dir() {
|
delete_lock_dir() {
|
||||||
trap '' EXIT INT QUIT TERM
|
trap '' EXIT INT QUIT TERM
|
||||||
[ -n "$lock_dir" ] && command rm -rf "$lock_dir"
|
[ -n "$lock_dir" ] && {
|
||||||
|
# switch to normal mode
|
||||||
|
printf "\033[?1049l"
|
||||||
|
command rm -rf "$lock_dir"
|
||||||
|
lock_dir=""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exec_kitty() {
|
exec_kitty() {
|
||||||
@ -23,9 +28,10 @@ script_dir=$(command dirname "$script_path")
|
|||||||
install_dir="$(command dirname "$script_dir")/install"
|
install_dir="$(command dirname "$script_dir")/install"
|
||||||
local_kitty_version_file="$install_dir/installed-kitty-version"
|
local_kitty_version_file="$install_dir/installed-kitty-version"
|
||||||
kitty_exe="$install_dir/bin/kitty"
|
kitty_exe="$install_dir/bin/kitty"
|
||||||
|
what="installed"
|
||||||
|
|
||||||
if [ -r "$local_kitty_version_file" -a -f "$local_kitty_version_file" ]; then
|
if [ -r "$local_kitty_version_file" -a -f "$local_kitty_version_file" ]; then
|
||||||
if [ $? = 0 ]; then
|
what="updated"
|
||||||
version_sort_key() {
|
version_sort_key() {
|
||||||
printf "%05d%05d%05d" $(echo "$1" | command tr '.' '\n' | command head -n 3)
|
printf "%05d%05d%05d" $(echo "$1" | command tr '.' '\n' | command head -n 3)
|
||||||
}
|
}
|
||||||
@ -35,7 +41,6 @@ if [ -r "$local_kitty_version_file" -a -f "$local_kitty_version_file" ]; then
|
|||||||
[ $? = 0 ] || die "Failed to read local kitty version"
|
[ $? = 0 ] || die "Failed to read local kitty version"
|
||||||
[ $(version_sort_key "$remote_kitty_version") -le $(version_sort_key "$local_kitty_version") ] && exec_kitty "$@"
|
[ $(version_sort_key "$remote_kitty_version") -le $(version_sort_key "$local_kitty_version") ] && exec_kitty "$@"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
case "$(command uname)" in
|
case "$(command uname)" in
|
||||||
'Linux') OS="linux";;
|
'Linux') OS="linux";;
|
||||||
@ -89,6 +94,9 @@ if ! command mkdir "$lock_dir" 2> /dev/null; then
|
|||||||
fi
|
fi
|
||||||
trap 'delete_lock_dir' EXIT INT QUIT TERM
|
trap 'delete_lock_dir' EXIT INT QUIT TERM
|
||||||
|
|
||||||
|
# switch to alternate screen
|
||||||
|
printf "\033[?1049h"
|
||||||
|
printf "\033[33mkitty needs to be %s\033[m\n\n" "$what"
|
||||||
command rm -rf "$install_dir"
|
command rm -rf "$install_dir"
|
||||||
command mkdir -p "$install_dir"
|
command mkdir -p "$install_dir"
|
||||||
printf "Downloading kitty from: \033[32m%s\033[m\n\n" "$url"
|
printf "Downloading kitty from: \033[32m%s\033[m\n\n" "$url"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user