From c2c5dcd12aa61feb444495d22db336ba2969e60f Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Wed, 16 Feb 2022 12:48:04 -0300 Subject: [PATCH] Update displayDialogBox() --- scripts/common.sh | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index de94a1c..746c5fb 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -2,36 +2,18 @@ displayDialogBox() { case $dialogBox in - whiptail) - if [[ "$1" == "--checklist" || "$1" == "--menu" ]]; then - useWhiptailListOrMenu "$@" - else - [ "$1" = "--infobox" ] && tty | grep -q "/dev/pts" && local TERM=ansi - useWhiptail "$@" - fi - ;; - dialog) - if [[ "$1" == "--checklist" || "$1" == "--menu" ]]; then - useDialogListOrMenu "$@" - else - useDialog "$@" - fi - ;; - plain) - if [ "$1" = "--menu" ]; then - usePlainTextMenu "$@" - else - usePlainText "$@" - fi - ;; - ?) - echo "Unknown dialogBox variable" >&2 - exit 1 - ;; + whiptail) useWhiptail "$@" ;; + dialog) useDialog "$@" ;; + plain) usePlainText "$@" ;; + ?) echo "Unknown dialogBox variable" >&2 && exit 1 ;; esac } useDialog() { + if [[ "$1" == "--checklist" || "$1" == "--menu" ]]; then + useDialogListOrMenu "$@" + exit + fi inputbox=false; passwordbox=false; infobox=false; threebuttons=false; yesno=false str=$(getLastArgument "$@") if [ "$str" = "VALUES" ]; then @@ -68,6 +50,11 @@ useDialog() { } useWhiptail() { + if [[ "$1" == "--checklist" || "$1" == "--menu" ]]; then + useWhiptailListOrMenu "$@" + exit + fi + [ "$1" = "--infobox" ] && tty | grep -q "/dev/pts" && local TERM=ansi inputbox=false; infobox=false; threebuttons=false; yesno=false str=$(getLastArgument "$@") if [ "$str" = "VALUES" ]; then @@ -110,6 +97,10 @@ printLine() { } usePlainText() { + if [ "$1" = "--menu" ]; then + usePlainTextMenu "$@" + exit + fi clear inputbox=false; infobox=false; msgbox=false; passwordbox=false; yesno=false for item in "$@"; do