Allow cancelling dialogues using CTRL+C

This commit is contained in:
Manuel Thalmann 2024-09-22 18:51:45 +02:00
parent 9540680341
commit 33758298cf
2 changed files with 2 additions and 0 deletions

View file

@ -29,6 +29,7 @@ function chooseDisk -a outFile message
end end
read -lP "Your choice: " choice read -lP "Your choice: " choice
or exit 1
if [ "$choice" -ge 1 ] && [ "$choice" -le "$diskCount" ] if [ "$choice" -ge 1 ] && [ "$choice" -le "$diskCount" ]
set -l disk (string split -n " " "$disks[$(math "$choice" + 1)]") set -l disk (string split -n " " "$disks[$(math "$choice" + 1)]")

View file

@ -4,6 +4,7 @@ function confirm -a message default
while true while true
read -l value -P "$message $options " read -l value -P "$message $options "
or exit 1
set value (string lower "$value") set value (string lower "$value")
if [ -z "$value" ] if [ -z "$value" ]