summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-10-28 13:26:24 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-10-28 13:26:24 (EDT)
commit18c8a7b8baa6141b1b5e0a78ac4d48f6cddf8e0e (patch)
tree936f2e655dfdc3cc3f6390ef083f93bf3af1c191
parent213f8594c0ca2f6db69880d3e6098e5155d6a89e (diff)
downloadfirman.sh-18c8a7b8baa6141b1b5e0a78ac4d48f6cddf8e0e.zip
firman.sh-18c8a7b8baa6141b1b5e0a78ac4d48f6cddf8e0e.tar.gz
firman.sh-18c8a7b8baa6141b1b5e0a78ac4d48f6cddf8e0e.tar.bz2
show_prompt(): New function
-rw-r--r--src/ui.sh2
-rw-r--r--src/ui/cli.sh16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/ui.sh b/src/ui.sh
index 5336c5e..23f9236 100644
--- a/src/ui.sh
+++ b/src/ui.sh
@@ -29,7 +29,7 @@ init_ui()
;;
esac
- for fn in exit_ui resume_ui show_menu; do
+ for fn in exit_ui resume_ui show_menu show_prompt; do
eval "${fn}() { ${ui}_${fn} \"\${@}\"; }"
done
for fn in dbg info warn err; do
diff --git a/src/ui/cli.sh b/src/ui/cli.sh
index 3471431..2325c5b 100644
--- a/src/ui/cli.sh
+++ b/src/ui/cli.sh
@@ -95,3 +95,19 @@ cli_show_menu()
return 0
done
}
+
+cli_show_prompt()
+{
+ local title="${1}"
+ local input=''
+ shift 1
+
+ printf '%s\n' "${title}" >"${cli_tty}"
+ { printf '%s\n' "${title}" | sed 's/./-/g'; } >"${cli_tty}"
+
+ printf '\n> ' >"${cli_tty}"
+ read -r input
+ printf '\n' >"${cli_tty}"
+ printf '%s' "${input}"
+ return 0
+}