@@ -32,21 +32,6 @@ function ui {
3232 fi
3333}
3434
35- # @description
36- # Decides with backend to use based on tty and DISPLAY.
37- # Called automatically at the end of this script. Does nothing on subsequent calls.
38- function ui#init
39- {
40- [ -v ui__interfaceBackend ] && return || true
41- if tty -s || [ -z "$DISPLAY" ]; then
42- ui__interfaceBackend="TTY"
43- source "$SH_LIB_DIR"/ui/tty.shl
44- else
45- ui__interfaceBackend="GUI"
46- source "$SH_LIB_DIR"/ui/gui.shl
47- fi
48- }
49-
5035function ui:requestConfirmation {
5136 local _message="${1:-Are you sure?}"
5237 if [ "$#" -gt 0 ]; then shift; fi
@@ -111,7 +96,7 @@ function ui:askChoice {
11196 [ "$1" != "--choices" ] || shift
11297
11398 local __choices=('')
114- local -a __textOverrides=()
99+ local -a __textOverrides
115100
116101 local index
117102 (( index=0 )) || true
@@ -187,6 +172,21 @@ function ui:errorAbort {
187172
188173# @section Private functions
189174
175+ # @description
176+ # Decides with backend to use based on tty and DISPLAY.
177+ # Called automatically at the end of this script. Does nothing on subsequent calls.
178+ function ui#init
179+ {
180+ [ -v ui__interfaceBackend ] && return || true
181+ if tty -s || [ -z "$DISPLAY" ]; then
182+ ui__interfaceBackend="TTY"
183+ source "$SH_LIB_DIR"/ui/tty.shl
184+ else
185+ ui__interfaceBackend="GUI"
186+ source "$SH_LIB_DIR"/ui/gui.shl
187+ fi
188+ }
189+
190190# @description simple helper that can be used to determine if a graphical dialog shall be shown
191191function ui#isGraphical
192192{ [ "$ui__interfaceBackend" = "GUI" ]; }
0 commit comments