Update useDialog()

This commit is contained in:
Santiago Lo Coco 2022-02-08 01:07:45 -03:00
parent 785048856e
commit 332e609218
2 changed files with 29 additions and 1 deletions

26
dialog.sh Normal file
View File

@ -0,0 +1,26 @@
source scripts/common.sh
displayDialogBox --yesno "\nWould you like to set up gitconfig?" || return
displayDialogBox --msgbox "\nNow, I will ask you for data to set up gitconfig personal account."
gitPersonalName=$(displayDialogBox --inputbox "\nEnter a name." VALUES 3>&1 1>&2 2>&3)
gitPersonalMail=$(displayDialogBox --inputbox "\nEnter an e-mail." VALUES 3>&1 1>&2 2>&3)
displayDialogBox --yesno "$msg" && break
gitPersonalName=$(displayDialogBox --inputbox "\nEnter a name." VALUES 3>&1 1>&2 2>&3)
gitPersonalMail=$(displayDialogBox --inputbox "\nEnter an e-mail." VALUES 3>&1 1>&2 2>&3)
displayDialogBox --yesno "\nWould you like to set up a work account?"
gitWorkPath=$(displayDialogBox --inputbox "$msg" VALUES 3>&1 1>&2 2>&3)
gitWorkPath=$(displayDialogBox --inputbox "$msg" VALUES 3>&1 1>&2 2>&3)
gitWorkName=$(displayDialogBox --inputbox "\nEnter a name." VALUES 3>&1 1>&2 2>&3)
gitWorkMail=$(displayDialogBox --inputbox "\nEnter an e-mail." VALUES 3>&1 1>&2 2>&3)
displayDialogBox --yesno "$msg" && break
gitWorkName=$(displayDialogBox --inputbox "\nEnter a name." VALUES 3>&1 1>&2 2>&3)
gitWorkMail=$(displayDialogBox --inputbox "\nEnter an e-mail." VALUES 3>&1 1>&2 2>&3)
displayDialogBox --title "sadedot" --yesno "$msg" || return
displayDialogBox --infobox "\nUpdating sadedot submodule."
displayDialogBox --title "sadedot" --msgbox "\nAll done! Enjoy..."
displayDialogBox() {
displayDialogBox --msgbox "$1" VALUES
displayDialogBox --infobox "\nUpdating sadedot submodule." VALUES
selectedOption=$(displayDialogBox --menu "$msg" VALUES 0 "${options[@]}" 3>&1 1>&2 2>&3)
displayDialogBox --yesno "$msg" || return
password=$(displayDialogBox --passwordbox "\nEnter your password." VALUES 3>&1 1>&2 2>&3)

View File

@ -34,7 +34,7 @@ displayDialogBox() {
}
useDialog() {
str=$(getLastArgument "$@"); inputbox=false; passwordbox=false
str=$(getLastArgument "$@"); inputbox=false; passwordbox=false; infobox=false
if [ "$str" = "VALUES" ]; then
argc="$#"; i=1
for item in "$@"; do
@ -44,6 +44,7 @@ useDialog() {
fi
[ "$item" = "--inputbox" ] && inputbox=true
[ "$item" = "--passwordbox" ] && passwordbox=true
[ "$item" = "--infobox" ] && infobox=true
((i++))
done
fi
@ -53,6 +54,7 @@ useDialog() {
width=$((width+15))
height=$((height+2))
fi
[ $infobox = true ] && height=$((height-2))
formatOptions "$@"
if [ "$found" = false ]; then
dialog "$@" ${height} ${width}