all repos — shlide @ 612a1e540c6e9601f56990f7011afce84c87f4e4

slide deck presentation tool written in pure bash

Clean up code, better docs

* Mention bash version requirement in the readme (#2)
* Remove redundant code

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Thu, 06 Feb 2020 10:55:32 +0530
commit

612a1e540c6e9601f56990f7011afce84c87f4e4

parent

13706d5e420cb01a44a3661458e35499c3c26651

2 files changed, 18 insertions(+), 10 deletions(-)

jump to
M readme.mdreadme.md

@@ -10,6 +10,10 @@ - Navigation using `j` / `k` or `n` / `p`.

- Text color and style formatting. - Pure bash. +## Requirements + +- `bash 4+` + ## Usage Create a directory for your slides. Name each slide starting with
M shlideshlide

@@ -1,7 +1,12 @@

#!/usr/bin/env bash -# -# Usage: shlide path/to/slides/ -# Each slide is a textfile under path/to/slides +# shellcheck disable=2154 +# +# shlide - a slide deck presentation tool written in pure bash +# https://github.com/icyphox/shlide +# +# The MIT License (MIT) +# +# Copyright (c) 2020 Anirudh Oppiliappan <x@icyphox.sh> # Color definitions. export BLK="\e[38;5;30m"

@@ -62,20 +67,20 @@ # 4 - total nr. of slides

slide_contents="$1" - # Hides the cursor. + # Hide the cursor. printf '\e[?25l' # Clear the screen. printf '\e[2J' - # Get screen size - shopt -s checkwinsize; (:;:) + # Get screen size. + read -r LINES COLUMNS < <(stty -F /dev/tty size) - # Write slide number at bottom left + # Write slide number at bottom left. printf '\e[H' printf '\e[%sB%s/%s' "$LINES" "$(($3+1))" "$4" - # Custom calculations to center text + # Custom calculations to center text. height=$(lines "$2") width=$(longest_line "$2")

@@ -109,7 +114,6 @@ exit 0

} display_end() { - read -r LINES COLUMNS < <(stty -F /dev/tty size) ((l=LINES/2)) ((c=COLUMNS/2 - 8)) printf '\e[2J'

@@ -129,7 +133,7 @@

# Capture Ctrl+C. trap 'die' INT - # Display END reached prompt, and then exit + # Display END reached prompt, and then exit. [[ "$i" -eq "${#slides[@]}" ]] && { display_end read -rsn1 input