From 189e4135ffadf9ae737d731194dfcdc55bcc60d7 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 1 Apr 2022 06:23:18 -0700 Subject: [PATCH] pandoc-make: better help page access --- .config/shell/bin/pandoc-make | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.config/shell/bin/pandoc-make b/.config/shell/bin/pandoc-make index a336f34..b10dafd 100755 --- a/.config/shell/bin/pandoc-make +++ b/.config/shell/bin/pandoc-make @@ -15,11 +15,15 @@ usage() { EOF } -if [ -z "$1" ]; then +# Help menu (yes, I forget how to use my own program sometimes) +if [[ -z "$1" ]]; then usage && exit 1 fi +if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then + usage && exit +fi -if [ -z "$2" ]; then +if [[ -z "$2" ]]; then echo "error: no files specified" usage && exit 1 fi @@ -28,7 +32,7 @@ SKIP_FIRST=true for FILE in "$@";do $SKIP_FIRST && SKIP_FIRST=false && continue - if [ -f "$FILE" ]; then + if [[ -f "$FILE" ]]; then pandoc -s "$FILE" -o "${FILE%.*}.${FORMAT##.}" fi done