summaryrefslogtreecommitdiff
path: root/libalpine.sh.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2021-01-08 12:25:21 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2021-01-08 12:39:00 +0100
commita1527866667bf1e63c50d099f0ea72fea08d4312 (patch)
treef43fc311898086ffd95ebd014f8b72ea420c6c81 /libalpine.sh.in
parent659147ca8e08da951d36ad9ff84e9f65412abbd5 (diff)
downloadalpine-conf-a1527866667bf1e63c50d099f0ea72fea08d4312.zip
libalpine.sh: add ask_yesno
add function for y/n questions
Diffstat (limited to 'libalpine.sh.in')
-rw-r--r--libalpine.sh.in16
1 files changed, 16 insertions, 0 deletions
diff --git a/libalpine.sh.in b/libalpine.sh.in
index 75ff585..75b94ae 100644
--- a/libalpine.sh.in
+++ b/libalpine.sh.in
@@ -229,6 +229,22 @@ ask_until() {
done
}
+# Ask for user for y/n until y, yes, n or no is responded
+#
+# $1 = the question to ask the user
+# $2 = the default answer
+#
+# Returns true/sucess if y/yes was responded. false othewise
+ask_yesno() {
+ while true; do
+ ask "$1" "$2"
+ case "$resp" in
+ y|yes|n|no) break;;
+ esac
+ done
+ yesno "$resp"
+}
+
# Ask for the user to select one value from a list, or 'done'.
#
# $1 = name of the list items (disk, cd, etc.)