Add help message

This commit is contained in:
Dan Church 2021-09-29 15:18:05 -05:00
parent 83aa3cf9ba
commit 96395f92e7
Signed by: h3xx
GPG Key ID: EA2BF379CD2CDBD0
1 changed files with 39 additions and 0 deletions

39
optipdf
View File

@ -1,6 +1,41 @@
#!/bin/bash
# vi: et sts=4 sw=4 ts=4
USAGE() {
printf 'Usage: %s [OPTIONS] [--] FILE...\n' \
"${0##*/}"
}
HELP_MESSAGE() {
USAGE
cat <<EOF
Optimize PDF files for size.
--help, -h Show this help message.
--backup=SUFFIX Keep a backup of un-optimized PDF files.
--no-backup Turn off backups (default).
--careful Stop if there are warnings in the PDF (default).
--no-careful Don't stop if there are warnings in the PDF.
--force, -f Force overwriting backups. No effect if --no-backup.
--no-force Prompt when overwriting backups (default). No effect if
--no-backup.
--lossy Let qpdf(1) try to optimize images for size. MAY LEAD TO
IMAGE QUALITY DEGRADATION. See qpdf(1) for more
information.
--no-lossy Don't optimize images (default). This is safer.
--preserve-timestamp Copy timestamp from original file.
--no-preserve-timestamp Omit timestamp from original file (default).
-- Terminate options list.
Copyright (C) 2021 Dan Church.
License GPLv3: GNU GPL version 3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
with Commons Clause 1.0 (https://commonsclause.com/).
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
You may NOT use this software for commercial purposes.
EOF
}
PRESERVE_TIMESTAMP=0
LOSSY=0
KEEP_BACKUP_SUFFIX=
@ -49,6 +84,10 @@ for ARG; do
--no-preserve-timestamp)
PRESERVE_TIMESTAMP=0
;;
--help|-h)
HELP_MESSAGE
exit 0
;;
--)
NO_MORE_FLAGS=1
;;