diff options
author | P. J. McDermott <pj@pehjota.net> | 2015-10-27 12:46:20 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2015-10-27 12:46:36 (EDT) |
commit | 33b86b5b03a29264812790aaff0e492c36a9fbe5 (patch) | |
tree | 36a43b1cda714a22d5e1da35e1931eb20e943e36 | |
parent | 9635a87d9476f0a8e4a3050399724698bb831c02 (diff) | |
download | firman.sh-33b86b5b03a29264812790aaff0e492c36a9fbe5.zip firman.sh-33b86b5b03a29264812790aaff0e492c36a9fbe5.tar.gz firman.sh-33b86b5b03a29264812790aaff0e492c36a9fbe5.tar.bz2 |
Validate UI option
-rw-r--r-- | src/main.sh | 4 | ||||
-rw-r--r-- | src/ui.sh | 9 |
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!' } @@ -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 |