Add yes/no validation
This commit is contained in:
parent
7f5d913b3c
commit
306024d7b0
|
@ -121,7 +121,13 @@ usePlainText() {
|
||||||
printLine
|
printLine
|
||||||
printf '\n%s' "[y/n] "
|
printf '\n%s' "[y/n] "
|
||||||
read -n 1 -r -s readVar
|
read -n 1 -r -s readVar
|
||||||
return $([[ "$readVar" =~ ^[Yy]$ ]])
|
while echo "$readVar" | grep -vqE '[yYnN]'; do
|
||||||
|
printf "\033[A"
|
||||||
|
printf '\n%s' "You need to type 'y' or 'n'"
|
||||||
|
printf '\n%s' "[y/n] "
|
||||||
|
read -n 1 -r -s readVar
|
||||||
|
done
|
||||||
|
[[ "$readVar" =~ ^[Yy]$ ]] && return 0 || return 1
|
||||||
elif [ $msgbox = true ]; then
|
elif [ $msgbox = true ]; then
|
||||||
printLine
|
printLine
|
||||||
printf '\n%s' "Press a key to continue... "
|
printf '\n%s' "Press a key to continue... "
|
||||||
|
|
Loading…
Reference in New Issue