summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ui.sh2
-rw-r--r--src/ui/cli.sh8
-rw-r--r--src/ui/tui.sh21
3 files changed, 26 insertions, 5 deletions
diff --git a/src/ui.sh b/src/ui.sh
index c127034..808a08e 100644
--- a/src/ui.sh
+++ b/src/ui.sh
@@ -32,7 +32,7 @@ init_ui()
for fn in exit_ui message show_menu show_prompt; do
eval "${fn}() { ${ui}_${fn} \"\${@}\"; }"
done
- for fn in dbg info warn err; do
+ for fn in dbg info notice warn err; do
eval "${fn}() { ${ui}_${fn} \"\${@}\"; log_${fn} \"\${@}\"; }"
done
diff --git a/src/ui/cli.sh b/src/ui/cli.sh
index ca78b04..5428319 100644
--- a/src/ui/cli.sh
+++ b/src/ui/cli.sh
@@ -41,6 +41,14 @@ cli_info()
printf "${fmt}\n" "${@}" >"${cli_tty}"
}
+cli_notice()
+{
+ local fmt="${1}"
+ shift 1
+
+ printf "${fmt}\n" "${@}" >"${cli_tty}"
+}
+
cli_warn()
{
local fmt="${1}"
diff --git a/src/ui/tui.sh b/src/ui/tui.sh
index ffd3430..3bc01ad 100644
--- a/src/ui/tui.sh
+++ b/src/ui/tui.sh
@@ -96,7 +96,8 @@ _tui_box()
_tui_dialog()
{
local lvl="${1}"
- local fmt="${2}"
+ local btn="${2}"
+ local fmt="${3}"
shift 2
local msg=''
@@ -131,6 +132,10 @@ _tui_dialog()
term_cursor_forward 1
term_write "${msg}"
+ if ! ${btn}; then
+ return 0
+ fi
+
# Draw a (selected) button.
term_cursor_back 4
term_cursor_down 2
@@ -157,7 +162,15 @@ tui_info()
local fmt="${1}"
shift 1
- _tui_dialog info "${fmt}" "${@}"
+ _tui_dialog info false "${fmt}" "${@}"
+}
+
+tui_notice()
+{
+ local fmt="${1}"
+ shift 1
+
+ _tui_dialog info true "${fmt}" "${@}"
}
tui_warn()
@@ -165,7 +178,7 @@ tui_warn()
local fmt="${1}"
shift 1
- _tui_dialog warn "${fmt}" "${@}"
+ _tui_dialog warn true "${fmt}" "${@}"
}
tui_err()
@@ -173,7 +186,7 @@ tui_err()
local fmt="${1}"
shift 1
- _tui_dialog err "${fmt}" "${@}"
+ _tui_dialog err true "${fmt}" "${@}"
}
tui_show_menu()