pandoc-make: better help page access

This commit is contained in:
PowerUser64 2022-04-01 06:23:18 -07:00
parent a42884c8d3
commit 189e4135ff

View file

@ -15,11 +15,15 @@ usage() {
EOF EOF
} }
if [ -z "$1" ]; then # Help menu (yes, I forget how to use my own program sometimes)
if [[ -z "$1" ]]; then
usage && exit 1 usage && exit 1
fi fi
if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then
usage && exit
fi
if [ -z "$2" ]; then if [[ -z "$2" ]]; then
echo "error: no files specified" echo "error: no files specified"
usage && exit 1 usage && exit 1
fi fi
@ -28,7 +32,7 @@ SKIP_FIRST=true
for FILE in "$@";do for FILE in "$@";do
$SKIP_FIRST && SKIP_FIRST=false && continue $SKIP_FIRST && SKIP_FIRST=false && continue
if [ -f "$FILE" ]; then if [[ -f "$FILE" ]]; then
pandoc -s "$FILE" -o "${FILE%.*}.${FORMAT##.}" pandoc -s "$FILE" -o "${FILE%.*}.${FORMAT##.}"
fi fi
done done