all repos — shlide @ 9da2d560a0872ec4a1cf4a847ec3555983cc746f

slide deck presentation tool written in pure bash

add end reached prompt
Akshay nerdypepper@tuta.io
Sun, 02 Feb 2020 20:30:07 +0530
commit

9da2d560a0872ec4a1cf4a847ec3555983cc746f

parent

5d12553068e4013879f2d21010a89ee1d1e399a1

1 files changed, 23 insertions(+), 4 deletions(-)

jump to
M shlideshlide

@@ -60,6 +60,15 @@ done <<< "$slide_contents"

} +display_end() { + read -r LINES COLUMNS < <(stty -F /dev/tty size) + ((l=$LINES/2)) + ((c=$COLUMNS/2 - 8)) + printf '\e[2J' + printf '\e[0;%sH' "$c" + printf 'END. Press q to quit' +} + main() { slides_dir="${1:-./}"

@@ -67,10 +76,20 @@ slides=("$slides_dir"/[0-9]*.txt)

i=0 while true; do - # Exit after last slide. - [[ "$i" -gt "$((${#slides[@]} - 1))" ]] && { - printf '\e[?25h' - exit + # Display END reached prompt, and then exit + [[ "$i" -eq "${#slides[@]}" ]] && { + display_end + read -rsn1 input + case "$input" in + "j"|"n"|"q") + printf '\e[2J' + printf '\e[?25h' + exit + ;; + *) + ((--i)) + ;; + esac } # Don't go below 0.