瀏覽代碼

irc configuration menu style

Bob Mottram 7 年之前
父節點
當前提交
caf8fa57e8
共有 1 個文件被更改,包括 11 次插入17 次删除
  1. 11
    17
      src/freedombone-app-irc

+ 11
- 17
src/freedombone-app-irc 查看文件

@@ -398,28 +398,22 @@ function configure_interactive_irc {
398 398
         return
399 399
     fi
400 400
 
401
+    W=(1 $"Set a password for all IRC users"
402
+       2 $"Show current IRC login password")
403
+
401 404
     while true
402 405
     do
403
-        data=$(mktemp 2>/dev/null)
404
-        dialog --backtitle $"Freedombone Control Panel" \
405
-               --title $"IRC Menu" \
406
-               --radiolist $"Choose an operation:" 14 70 4 \
407
-               1 $"Set a password for all IRC users" off \
408
-               2 $"Show current IRC login password" off \
409
-               3 $"Exit" on 2> "$data"
410
-        sel=$?
411
-        case $sel in
412
-            1) rm -f "$data"
413
-               break;;
414
-            255) rm -f "$data"
415
-                 break;;
416
-        esac
417
-        case $(cat "$data") in
406
+        # shellcheck disable=SC2068
407
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"IRC" --menu $"Choose an operation, or ESC to exit:" 10 60 2 "${W[@]}" 3>&2 2>&1 1>&3)
408
+
409
+        if [ ! "$selection" ]; then
410
+            break
411
+        fi
412
+
413
+        case $selection in
418 414
             1) irc_set_global_password;;
419 415
             2) irc_show_password;;
420
-            3) break;;
421 416
         esac
422
-        rm -f "$data"
423 417
     done
424 418
 }
425 419