···1010- Text color and style formatting.
1111- Pure bash.
12121313+## Requirements
1414+1515+- `bash 4+`
1616+1317## Usage
14181519Create a directory for your slides. Name each slide starting with
+14-10
shlide
···11#!/usr/bin/env bash
22-#
33-# Usage: shlide path/to/slides/
44-# Each slide is a textfile under path/to/slides
22+# shellcheck disable=2154
33+#
44+# shlide - a slide deck presentation tool written in pure bash
55+# https://github.com/icyphox/shlide
66+#
77+# The MIT License (MIT)
88+#
99+# Copyright (c) 2020 Anirudh Oppiliappan <x@icyphox.sh>
510611# Color definitions.
712export BLK="\e[38;5;30m"
···62676368 slide_contents="$1"
64696565- # Hides the cursor.
7070+ # Hide the cursor.
6671 printf '\e[?25l'
67726873 # Clear the screen.
6974 printf '\e[2J'
70757171- # Get screen size
7272- shopt -s checkwinsize; (:;:)
7676+ # Get screen size.
7777+ read -r LINES COLUMNS < <(stty -F /dev/tty size)
73787474- # Write slide number at bottom left
7979+ # Write slide number at bottom left.
7580 printf '\e[H'
7681 printf '\e[%sB%s/%s' "$LINES" "$(($3+1))" "$4"
77827878- # Custom calculations to center text
8383+ # Custom calculations to center text.
7984 height=$(lines "$2")
8085 width=$(longest_line "$2")
8186···109114}
110115111116display_end() {
112112- read -r LINES COLUMNS < <(stty -F /dev/tty size)
113117 ((l=LINES/2))
114118 ((c=COLUMNS/2 - 8))
115119 printf '\e[2J'
···129133 # Capture Ctrl+C.
130134 trap 'die' INT
131135132132- # Display END reached prompt, and then exit
136136+ # Display END reached prompt, and then exit.
133137 [[ "$i" -eq "${#slides[@]}" ]] && {
134138 display_end
135139 read -rsn1 input