Add support for passwordbox

This commit is contained in:
Santiago Lo Coco 2022-01-19 18:14:37 -03:00
parent e0826f18ac
commit 108c8e34cd
1 changed files with 5 additions and 1 deletions

View File

@ -92,12 +92,13 @@ useWhiptail() {
}
usePlainText() {
inputbox=false; infobox=false; yesno=false
inputbox=false; infobox=false; passwordbox=false; yesno=false
for item in "$@"; do
case $item in
--title) shift && shift ;;
--inputbox) inputbox=true ;;
--infobox) infobox=true ;;
--passwordbox) passwordbox=true ;;
--yesno) yesno=true ;;
esac
done
@ -105,6 +106,9 @@ usePlainText() {
if [ $inputbox = true ]; then
read -r readVar
printf "$readVar" 1>&2
elif [ $passwordbox = true ]; then
read -r -s readVar
printf "$readVar" 1>&2
elif [ $yesno = true ]; then
printf "[y/n] "
read -n 1 -r readVar