slide deck presentation tool written in pure bash

Init

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>

+7
Makefile
··· 1 + PREFIX ?= /usr 2 + 3 + install: 4 + install -Dm755 pw $(DESTDIR)$(PREFIX)/bin/shlide 5 + 6 + uninstall: 7 + rm -f $(DESTDIR)$(PREFIX)/bin/shlide
+8
example/1-hi.txt
··· 1 + HI THERE 2 + 3 + Welcome to shlide. Here are a few bullet points: 4 + 5 + - first point 6 + - second point 7 + * sub point 8 + * another sub point
+7
example/2-another.txt
··· 1 + THIS IS ANOTHER SLIDE 2 + 3 + We've got some more info here! 4 + 5 + - like this point 6 + - and this one 7 + - the last one, I promise
+3
example/3-bye.txt
··· 1 + THAT'S IT, BYE! 2 + 3 + And we're done.
+5
readme.md
··· 1 + # shlide 2 + > a slide deck presentation tool written in pure bash 3 + 4 + ![scrot](https://x.icyphox.sh/NBq.png) 5 +
+81
shlide
··· 1 + #!/usr/bin/env bash 2 + # 3 + # Usage: shlide path/to/slides/ 4 + # Each slide is a textfile under path/to/slides 5 + 6 + # Color definitions 7 + 8 + #BLK="\e[30m" 9 + #RED="\e[31m" 10 + #GRN="\e[32m" 11 + #YLW="\e[33m" 12 + #BLU="\e[34m" 13 + #PUR="\e[35m" 14 + #CYN="\e[36m" 15 + 16 + lstrip() { 17 + # See: https://github.com/dylanaraps/pure-bash-bible#strip-pattern-from-start-of-string 18 + printf '%s\n' "${1##$2}" 19 + } 20 + 21 + get_term_size() { 22 + 23 + # POSIX alternative to 'checkwinsize'. 24 + read -r LINES COLUMNS < <(stty -F /dev/tty size) 25 + 26 + } 27 + 28 + # navigate() { 29 + # case "$1" in 30 + # "j") 31 + # } 32 + 33 + display() { 34 + # 1 - slide contents 35 + # 2 - slide name 36 + 37 + slide_contents="$1" 38 + # slide_name="$(lstrip $2 "[0-9]-")" 39 + 40 + # Hides the cursor. 41 + printf '\e[?25l' 42 + 43 + # Clear the screen. 44 + printf '\e[2J' 45 + 46 + # Move the cursor to the center. 47 + get_term_size 48 + 49 + # Rough estimates for the true center. 50 + ((l=0)) 51 + ((c=0)) 52 + printf '\e[%s;%sH' "$l" "$c" 53 + 54 + while IFS= read -r line; do 55 + # Print the contents of the slide file, 56 + # line by line. 57 + printf '%s' "$line" 58 + # Move down and back after each print. 59 + printf '\e[%sD\e[B' "${#line}" 60 + done <<< "$slide_contents" 61 + 62 + # Change slide on space. 63 + read -rsn1 input 64 + #navigate "$input" 65 + } 66 + 67 + main() { 68 + 69 + slides_dir="$1" 70 + 71 + for f in "$slides_dir"/[0-9]*.txt; do 72 + f_contents="$(<$f)" 73 + display "$f_contents" "$f" 74 + done 75 + 76 + # Return the cursor. 77 + printf '\e[?25h' 78 + 79 + } 80 + 81 + main "$@"