summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.sh4
-rw-r--r--src/ui.sh9
2 files changed, 12 insertions, 1 deletions
diff --git a/src/main.sh b/src/main.sh
index c62262e..4c9f849 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -72,6 +72,8 @@ main()
exit 1
fi
- init_ui "${ui}"
+ if ! init_ui "${ui}"; then
+ exit 1
+ fi
info 'Hello, world!'
}
diff --git a/src/ui.sh b/src/ui.sh
index f6e225c..ea4071e 100644
--- a/src/ui.sh
+++ b/src/ui.sh
@@ -22,6 +22,15 @@ init_ui()
local ui="${1}"
local fn=
+ case "${ui}" in
+ 'cli' | 'tui')
+ ;;
+ *)
+ printf 'Error: Invalid UI "%s"\n' "${ui}" >&2
+ return 1
+ ;;
+ esac
+
for fn in ${ui_functions}; do
eval "${fn}() { ${ui}_${fn} \"\${@}\"; }"
done