浏览代码

scuttlebot configuration menu style

Bob Mottram 7 年前
父节点
当前提交
85b7fbdecd
共有 1 个文件被更改,包括 10 次插入17 次删除
  1. 10
    17
      src/freedombone-app-scuttlebot

+ 10
- 17
src/freedombone-app-scuttlebot 查看文件

@@ -67,27 +67,20 @@ function scuttlebot_create_invite {
67 67
 }
68 68
 
69 69
 function configure_interactive_scuttlebot {
70
+    W=(1 $"Create an invite")
71
+
70 72
     while true
71 73
     do
72
-        data=$(mktemp 2>/dev/null)
73
-        dialog --backtitle $"Freedombone Control Panel" \
74
-               --title $"Scuttlebot" \
75
-               --radiolist $"Choose an operation:" 10 50 2 \
76
-               1 $"Create an invite" off \
77
-               2 $"Exit" on 2> "$data"
78
-        sel=$?
79
-        case $sel in
80
-            1) rm -f "$data"
81
-               return;;
82
-            255) rm -f "$data"
83
-                 return;;
84
-        esac
85
-        case $(cat "$data") in
74
+        # shellcheck disable=SC2068
75
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Scuttlebot" --menu $"Choose an operation, or ESC to exit:" 10 60 2 "${W[@]}" 3>&2 2>&1 1>&3)
76
+
77
+        if [ ! "$selection" ]; then
78
+            break
79
+        fi
80
+
81
+        case $selection in
86 82
             1) scuttlebot_create_invite;;
87
-            2) rm -f "$data"
88
-               break;;
89 83
         esac
90
-        rm -f "$data"
91 84
     done
92 85
 }
93 86