Add a --help option

pull/2205/head
Ira Abramov 2023-04-17 16:48:59 +03:00
parent e38696a0ac
commit cb44790e61
1 changed files with 8 additions and 2 deletions

View File

@ -64,7 +64,7 @@ function v2gif() {
fi fi
# Parse the options # Parse the options
args=$("$getopt" -l "alert:" -l "lossy:" -l "width:" -l del,delete -l high -l tag -l "fps:" -l webm -o "a:l:w:f:dhmt" -- "$@") || { args=$("$getopt" -l "alert:" -l "lossy:" -l "width:" -l del,delete -l high -l help -l tag -l "fps:" -l webm -o "a:l:w:f:dhmt" -- "$@") || {
echo 'Terminating...' >&2 echo 'Terminating...' >&2
return 2 return 2
} }
@ -82,6 +82,7 @@ function v2gif() {
local fps="" local fps=""
local make_webm="" local make_webm=""
local alert=5000 local alert=5000
local printhelp=""
while [[ $# -ge 1 ]]; do while [[ $# -ge 1 ]]; do
case "$1" in case "$1" in
--) --)
@ -94,6 +95,11 @@ function v2gif() {
opt_del_after="true" opt_del_after="true"
shift shift
;; ;;
--help)
# Print Help
printhelp="true"
shift
;;
-h | --high) -h | --high)
#High Quality, use gifski #High Quality, use gifski
gifski="$(type -p gifski)" gifski="$(type -p gifski)"
@ -141,7 +147,7 @@ function v2gif() {
esac esac
done done
if [[ -z "$*" ]]; then if [[ -z "$*" || "$printhelp" ]]; then
echo "$(tput setaf 1)No input files given. Example: v2gif file [file...] [-w <max width (pixels)>] [-l <lossy level>] $(tput sgr 0)" echo "$(tput setaf 1)No input files given. Example: v2gif file [file...] [-w <max width (pixels)>] [-l <lossy level>] $(tput sgr 0)"
echo "-d/--del/--delete Delete original vid if done suceessfully (and file not over the size limit)" echo "-d/--del/--delete Delete original vid if done suceessfully (and file not over the size limit)"
echo "-h/--high High Quality - use Gifski instead of gifsicle" echo "-h/--high High Quality - use Gifski instead of gifsicle"