diff options
Diffstat (limited to 'contrib/bsddialog/examples_utility')
-rw-r--r-- | contrib/bsddialog/examples_utility/calendar.sh | 34 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/checklist.sh | 16 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/datebox.sh | 34 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/form.sh | 14 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/infobox.sh | 2 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/inputbox.sh | 5 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/menu.sh | 13 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/mixedform.sh | 10 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/mixedgauge.sh | 10 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/passwordbox.sh | 4 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/passwordform.sh | 14 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/radiolist.sh | 18 | ||||
-rw-r--r-- | contrib/bsddialog/examples_utility/rangebox.sh | 33 | ||||
-rwxr-xr-x | contrib/bsddialog/examples_utility/timebox.sh | 3 |
14 files changed, 150 insertions, 60 deletions
diff --git a/contrib/bsddialog/examples_utility/calendar.sh b/contrib/bsddialog/examples_utility/calendar.sh new file mode 100644 index 000000000000..a7ce4f1bb1d5 --- /dev/null +++ b/contrib/bsddialog/examples_utility/calendar.sh @@ -0,0 +1,34 @@ +#!/bin/sh +#- +# SPDX-License-Identifier: CC0-1.0 +# +# Written in 2022 by Alfonso Sabato Siciliano. +# +# To the extent possible under law, the author has dedicated all copyright +# and related and neighboring rights to this software to the public domain +# worldwide. This software is distributed without any warranty, see: +# <http://creativecommons.org/publicdomain/zero/1.0/>. + +: ${BSDDIALOG_ERROR=255} +: ${BSDDIALOG_OK=0} +: ${BSDDIALOG_CANCEL=1} +: ${BSDDIALOG_ESC=5} + +DATE=$(./bsddialog --title " calendar " --date-format "%x" \ + --calendar "Hello World!" 20 40 \ +3>&1 1>&2 2>&3 3>&-) + +case $? in + $BSDDIALOG_ERROR ) + exit 1 + ;; + $BSDDIALOG_ESC ) + echo "[ESC]" + ;; + $BSDDIALOG_CANCEL ) + echo "[Cancel]" + ;; + $BSDDIALOG_OK ) + echo "[OK] $DATE" + ;; +esac diff --git a/contrib/bsddialog/examples_utility/checklist.sh b/contrib/bsddialog/examples_utility/checklist.sh index fefabc282c80..7ff525cf765d 100755 --- a/contrib/bsddialog/examples_utility/checklist.sh +++ b/contrib/bsddialog/examples_utility/checklist.sh @@ -15,11 +15,11 @@ : ${BSDDIALOG_ESC=5} ITEMS=$(./bsddialog --title " checklist " --checklist "Hello World!" 15 30 5 \ - "Tag 1" "DESC 1 xyz" on \ - "Tag 2" "DESC 2 xyz" off \ - "Tag 3" "DESC 3 xyz" on \ - "Tag 4" "DESC 4 xyz" off \ - "Tag 5" "DESC 5 xyz" on \ + "1 Name" "DESC 1 xyz" on \ + "2 Name" "DESC 2 xyz" off \ + "3 Name" "DESC 3 xyz" on \ + "4 Name" "DESC 4 xyz" off \ + "5 Name" "DESC 5 xyz" on \ 3>&1 1>&2 2>&3 3>&-) case $? in @@ -27,12 +27,12 @@ case $? in exit 1 ;; $BSDDIALOG_ESC ) - echo "[ESC] focus: $ITEMS" + echo "[ESC]" ;; $BSDDIALOG_CANCEL ) - echo "[Cancel] focus: $ITEMS" + echo "[Cancel]" ;; $BSDDIALOG_OK ) - echo "[OK] Selected: $ITEMS" + echo "[OK] $ITEMS" ;; esac diff --git a/contrib/bsddialog/examples_utility/datebox.sh b/contrib/bsddialog/examples_utility/datebox.sh new file mode 100755 index 000000000000..bea4559dfbec --- /dev/null +++ b/contrib/bsddialog/examples_utility/datebox.sh @@ -0,0 +1,34 @@ +#!/bin/sh +#- +# SPDX-License-Identifier: CC0-1.0 +# +# Written in 2023 by Alfonso Sabato Siciliano. +# +# To the extent possible under law, the author has dedicated all copyright +# and related and neighboring rights to this software to the public domain +# worldwide. This software is distributed without any warranty, see: +# <http://creativecommons.org/publicdomain/zero/1.0/>. + +: ${BSDDIALOG_ERROR=255} +: ${BSDDIALOG_OK=0} +: ${BSDDIALOG_CANCEL=1} +: ${BSDDIALOG_ESC=5} + +DATE=$(./bsddialog --title " datebox " --date-format "%x" \ + --datebox "Hello World!" 9 30 \ +3>&1 1>&2 2>&3 3>&-) + +case $? in + $BSDDIALOG_ERROR ) + exit 1 + ;; + $BSDDIALOG_ESC ) + echo "[ESC]" + ;; + $BSDDIALOG_CANCEL ) + echo "[Cancel]" + ;; + $BSDDIALOG_OK ) + echo "[OK] $DATE" + ;; +esac diff --git a/contrib/bsddialog/examples_utility/form.sh b/contrib/bsddialog/examples_utility/form.sh index bd1bac8a3939..ee25fa9cf352 100755 --- a/contrib/bsddialog/examples_utility/form.sh +++ b/contrib/bsddialog/examples_utility/form.sh @@ -15,11 +15,11 @@ : ${BSDDIALOG_ESC=5} FORMS=$(./bsddialog --title " form " --form "Hello World!" 12 40 5 \ - Label1: 1 1 Value1 1 9 18 25 \ - Label2: 2 1 Value2 2 9 18 25 \ - Label3: 3 1 Value3 3 9 18 25 \ - Label4: 4 1 Value4 4 9 18 25 \ - Label5: 5 1 Value5 5 9 18 25 \ + Label1: 0 0 Value1 0 8 18 25 \ + Label2: 1 0 Value2 1 8 18 25 \ + Label3: 2 0 Value3 2 8 18 25 \ + Label4: 3 0 Value4 3 8 18 25 \ + Label5: 4 0 Value5 4 8 18 25 \ 3>&1 1>&2 2>&3 3>&-) case $? in @@ -33,8 +33,6 @@ case $? in echo "[Cancel]" ;; $BSDDIALOG_OK ) - echo "[OK]" + echo "[OK] $FORMS" ;; esac - -echo "$FORMS" diff --git a/contrib/bsddialog/examples_utility/infobox.sh b/contrib/bsddialog/examples_utility/infobox.sh index ff39ad4d5f0e..b782e8cbf69e 100755 --- a/contrib/bsddialog/examples_utility/infobox.sh +++ b/contrib/bsddialog/examples_utility/infobox.sh @@ -9,4 +9,4 @@ # worldwide. This software is distributed without any warranty, see: # <http://creativecommons.org/publicdomain/zero/1.0/>. -./bsddialog --sleep 3 --title " infobox " --infobox "Hello World!\n3 secs" 6 20 +./bsddialog --normal-screen --title " infobox " --infobox "Hello World!" 6 20 diff --git a/contrib/bsddialog/examples_utility/inputbox.sh b/contrib/bsddialog/examples_utility/inputbox.sh index a359a3b8e833..756aec3c0241 100755 --- a/contrib/bsddialog/examples_utility/inputbox.sh +++ b/contrib/bsddialog/examples_utility/inputbox.sh @@ -28,9 +28,6 @@ case $? in echo "[Cancel]" ;; $BSDDIALOG_OK ) - echo "[OK]" + echo "[OK] $FORM" ;; esac - -echo "$FORM" - diff --git a/contrib/bsddialog/examples_utility/menu.sh b/contrib/bsddialog/examples_utility/menu.sh index 002a82f6a870..5b2f090037d8 100755 --- a/contrib/bsddialog/examples_utility/menu.sh +++ b/contrib/bsddialog/examples_utility/menu.sh @@ -15,10 +15,11 @@ : ${BSDDIALOG_ESC=5} ITEM=$(./bsddialog --title " menu " --menu "Hello World!" 15 30 5 \ - "Tag 1" "DESC 1 xyz" \ - "Tag 2" "DESC 2 xyz" \ - "Tag 3" "DESC 3 xyz" \ - "Tag 4" "DESC 4 xyz" \ + "1 Name" "DESC 1 xyz" \ + "2 Name" "DESC 2 xyz" \ + "3 Name" "DESC 3 xyz" \ + "4 Name" "DESC 4 xyz" \ + "5 Name" "DESC 5 xyz" \ 3>&1 1>&2 2>&3 3>&-) case $? in @@ -26,10 +27,10 @@ case $? in exit 1 ;; $BSDDIALOG_ESC ) - echo "[ESC] $ITEM" + echo "[ESC]" ;; $BSDDIALOG_CANCEL ) - echo "[Cancel] $ITEM" + echo "[Cancel]" ;; $BSDDIALOG_OK ) echo "[OK] $ITEM" diff --git a/contrib/bsddialog/examples_utility/mixedform.sh b/contrib/bsddialog/examples_utility/mixedform.sh index 80b7abf93745..6b690e7e5b8c 100755 --- a/contrib/bsddialog/examples_utility/mixedform.sh +++ b/contrib/bsddialog/examples_utility/mixedform.sh @@ -16,9 +16,9 @@ FORMS=$(./bsddialog --insecure --title " mixedform " \ --mixedform "Hello World!" 12 40 3 \ - Label: 1 1 Entry 1 11 18 25 0 \ - Label: 2 1 Read-Only 2 11 18 25 2 \ - Password: 3 1 "" 3 11 18 25 1 \ + Label: 0 0 Entry 0 10 18 25 0 \ + Label: 1 0 Read-Only 1 10 18 25 2 \ + Password: 2 0 "" 2 10 18 25 1 \ 3>&1 1>&2 2>&3 3>&-) case $? in @@ -32,8 +32,6 @@ case $? in echo "[Cancel]" ;; $BSDDIALOG_OK ) - echo "[OK]" + echo "[OK] $FORMS" ;; esac - -echo "$FORMS" diff --git a/contrib/bsddialog/examples_utility/mixedgauge.sh b/contrib/bsddialog/examples_utility/mixedgauge.sh index e98ff70614db..aa4ff2910cd9 100755 --- a/contrib/bsddialog/examples_utility/mixedgauge.sh +++ b/contrib/bsddialog/examples_utility/mixedgauge.sh @@ -10,11 +10,11 @@ # <http://creativecommons.org/publicdomain/zero/1.0/>. perc=0 +mainperc=50 while [ $perc -le 100 ] do ./bsddialog --sleep 1 --title " mixedgauge " \ - --mixedgauge "Example..." 20 45 $perc \ - "(Hidden)" " -9" \ + --mixedgauge "Example..." 20 45 $mainperc \ "Label 1" " -1" \ "Label 2" " -2" \ "Label 3" " -3" \ @@ -23,9 +23,11 @@ do "Label 6" " -6" \ "Label 7" " -7" \ "Label 8" " -8" \ - "Label 9" " -10" \ - "Label 10" " -11" \ + "Label 9" " -9" \ + "Label 10" " -10" \ + "Label 11" " -11" \ "Label X" $perc perc=`expr $perc + 20` + mainperc=`expr $mainperc + 10` done diff --git a/contrib/bsddialog/examples_utility/passwordbox.sh b/contrib/bsddialog/examples_utility/passwordbox.sh index 0f93a13c877c..b43ef6f6b994 100755 --- a/contrib/bsddialog/examples_utility/passwordbox.sh +++ b/contrib/bsddialog/examples_utility/passwordbox.sh @@ -29,8 +29,6 @@ case $? in echo "[Cancel]" ;; $BSDDIALOG_OK ) - echo "[OK]" + echo "[OK] $FORM" ;; esac - -echo "$FORM" diff --git a/contrib/bsddialog/examples_utility/passwordform.sh b/contrib/bsddialog/examples_utility/passwordform.sh index 19b3a355b6eb..874a185ee66f 100755 --- a/contrib/bsddialog/examples_utility/passwordform.sh +++ b/contrib/bsddialog/examples_utility/passwordform.sh @@ -16,11 +16,11 @@ FORMS=$(./bsddialog --insecure --title " passwordform " \ --passwordform "Example" 12 40 5 \ - Password1: 1 1 "" 1 12 18 25 \ - Password2: 2 1 "" 2 12 18 25 \ - Password3: 3 1 "" 3 12 18 25 \ - Password4: 4 1 "" 4 12 18 25 \ - Password5: 5 1 "" 5 12 18 25 \ + Password1: 0 0 "" 0 11 18 25 \ + Password2: 1 0 "" 1 11 18 25 \ + Password3: 2 0 "" 2 11 18 25 \ + Password4: 3 0 "" 3 11 18 25 \ + Password5: 4 0 "" 4 11 18 25 \ 3>&1 1>&2 2>&3 3>&-) case $? in @@ -34,8 +34,6 @@ case $? in echo "[Cancel]" ;; $BSDDIALOG_OK ) - echo "[OK]" + echo "[OK] $FORMS" ;; esac - -echo "$FORMS" diff --git a/contrib/bsddialog/examples_utility/radiolist.sh b/contrib/bsddialog/examples_utility/radiolist.sh index 9de483369c75..359473abf35e 100755 --- a/contrib/bsddialog/examples_utility/radiolist.sh +++ b/contrib/bsddialog/examples_utility/radiolist.sh @@ -15,11 +15,11 @@ : ${BSDDIALOG_ESC=5} ITEM=$(./bsddialog --title " radiolist " --radiolist "Hello World!" 15 30 5 \ - "Tag 1" "DESC 1 xyz" off \ - "Tag 2" "DESC 2 xyz" off \ - "Tag 3" "DESC 3 xyz" on \ - "Tag 4" "DESC 4 xyz" off \ - "Tag 5" "DESC 5 xyz" off \ + "1 Name" "DESC 1 xyz" off \ + "2 Name" "DESC 2 xyz" off \ + "3 Name" "DESC 3 xyz" on \ + "4 Name" "DESC 4 xyz" off \ + "5 Name" "DESC 5 xyz" off \ 3>&1 1>&2 2>&3 3>&-) case $? in @@ -27,14 +27,12 @@ case $? in exit 1 ;; $BSDDIALOG_ESC ) - echo "[ESC] focus " + echo "[ESC]" ;; $BSDDIALOG_CANCEL ) - echo "[Cancel] focus " + echo "[Cancel]" ;; $BSDDIALOG_OK ) - echo "[OK]" + echo "[OK] $ITEM" ;; esac - -echo "$ITEM" diff --git a/contrib/bsddialog/examples_utility/rangebox.sh b/contrib/bsddialog/examples_utility/rangebox.sh new file mode 100644 index 000000000000..9b3213d8acad --- /dev/null +++ b/contrib/bsddialog/examples_utility/rangebox.sh @@ -0,0 +1,33 @@ +#!/bin/sh +#- +# SPDX-License-Identifier: CC0-1.0 +# +# Written in 2023 by Alfonso Sabato Siciliano. +# +# To the extent possible under law, the author has dedicated all copyright +# and related and neighboring rights to this software to the public domain +# worldwide. This software is distributed without any warranty, see: +# <http://creativecommons.org/publicdomain/zero/1.0/>. + +: ${BSDDIALOG_ERROR=255} +: ${BSDDIALOG_OK=0} +: ${BSDDIALOG_CANCEL=1} +: ${BSDDIALOG_ESC=5} + +VALUE=$(./bsddialog --title " rangebox " --rangebox "Hello World!" 7 35 0 10 5 \ +3>&1 1>&2 2>&3 3>&-) + +case $? in + $BSDDIALOG_ERROR ) + exit 1 + ;; + $BSDDIALOG_ESC ) + echo "[ESC]" + ;; + $BSDDIALOG_CANCEL ) + echo "[Cancel]" + ;; + $BSDDIALOG_OK ) + echo "[OK] Value: $VALUE" + ;; +esac diff --git a/contrib/bsddialog/examples_utility/timebox.sh b/contrib/bsddialog/examples_utility/timebox.sh index 81d24d558dc9..233434b29195 100755 --- a/contrib/bsddialog/examples_utility/timebox.sh +++ b/contrib/bsddialog/examples_utility/timebox.sh @@ -14,8 +14,7 @@ : ${BSDDIALOG_CANCEL=1} : ${BSDDIALOG_ESC=5} -TIME=$(./bsddialog --title " timebox " \ - --timebox "Tab / Left / Right to move\nUp / Down to select" 10 40 \ +TIME=$(./bsddialog --title " timebox " --timebox "Hello World!" 8 25 \ 3>&1 1>&2 2>&3 3>&-) case $? in |