New menu style

This commit is contained in:
Bob Mottram 2018-04-09 17:06:50 +01:00
parent ff088f16d2
commit 13c7f604e9
1 changed files with 10 additions and 18 deletions

View File

@ -354,31 +354,23 @@ echo " echo -n ''"
echo '}' echo '}'
echo '' echo ''
echo "function configure_interactive_${app_name} {" echo "function configure_interactive_${app_name} {"
echo ' W=(1 $"Option 1"'
echo ' 2 $"Option 2")'
echo ''
echo ' while true' echo ' while true'
echo ' do' echo ' do'
echo " data=\$(mktemp 2>/dev/null)" echo ' # shellcheck disable=SC2068'
echo " dialog --backtitle \$\"Freedombone Control Panel\" \\" echo " selection=\$(dialog --backtitle \$\"Freedombone Administrator Control Panel\" --title \$\"${app_name}\" --menu \$\"Choose an operation, or ESC for main menu:\" 14 70 3 \"\${W[@]}\" 3>&2 2>&1 1>&3)"
echo " --title \$\"${app_name}\" \\" echo ''
echo " --radiolist \$\"Choose an operation:\" 16 70 3 \\" echo " if [ ! \"\$selection\" ]; then"
echo " 1 \$\"Option 1\" off \\" echo ' break'
echo " 2 \$\"Option 2\" off \\" echo ' fi'
echo " 3 \$\"Exit\" on 2> \"\$data\"" echo " case \$selection in"
echo ' sel=$?'
echo " case \$sel in"
echo " 1) rm -f \"\$data\""
echo ' return;;'
echo " 255) rm -f \"\$data\""
echo ' return;;'
echo ' esac'
echo " case \$(cat \"\$data\") in"
echo ' 1) # call some function for option 1' echo ' 1) # call some function for option 1'
echo ' ;;' echo ' ;;'
echo ' 2) # call some function for option 2' echo ' 2) # call some function for option 2'
echo ' ;;' echo ' ;;'
echo " 3) rm -f \"\$data\""
echo ' break;;'
echo ' esac' echo ' esac'
echo " rm -f \"\$data\""
echo ' done' echo ' done'
echo '}' echo '}'
echo '' echo ''