version: show a spinner while it checks for updates
shellcheck / shellcheck (push) Failing after 18s
shellcheck / shellcheck (push) Failing after 18s
Checking for newer versions goes to the network and can take several seconds with nothing on screen. Show "Checking for updates..." with a spinner on the terminal until every check is done, then print the results all at once. The spinner goes to stderr and only to a terminal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -133,3 +133,18 @@ sibling_repo() {
|
||||
[[ "$output" == *"tools is at v1.1.0."* ]]
|
||||
[ "$(cat "$HOME/updated")" = "$HOME/.local/share/siblings/tools" ]
|
||||
}
|
||||
|
||||
@test "version shows a spinner on a terminal while it checks, and clears it" {
|
||||
run script -qec "bash '$CD/version'" /dev/null < /dev/null
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Checking for updates..."* ]]
|
||||
# Cleared, and the cursor shown again, before the results are printed
|
||||
[[ "$output" == *$'\r\e[K\e[?25hCoreDesktop 2026.10.31'* ]]
|
||||
}
|
||||
|
||||
@test "version shows no spinner when its output isn't a terminal" {
|
||||
run bash "$CD/version"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != *"Checking"* ]]
|
||||
[[ "$output" != *$'\e[?25l'* ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user