diff options
-rw-r--r-- | src/ui.sh | 2 | ||||
-rw-r--r-- | src/ui/cli.sh | 16 |
2 files changed, 17 insertions, 1 deletions
@@ -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 +} |