small fixes

This commit is contained in:
2025-10-24 20:46:04 -05:00
parent 2cc802ff78
commit 1a6f442679
3 changed files with 21 additions and 12 deletions

View File

@@ -52,6 +52,7 @@ set_efg_opts() {
INPUT="${OPTARG}"
;;
p)
missing_cmd gnuplot && return 1
PLOT=true
;;
l)

View File

@@ -235,7 +235,7 @@ set_encode_opts() {
C)
if ! is_positive_integer "${OPTARG}" || test ${OPTARG} -gt 63; then
echo_fail "${OPTARG} is not a valid CRF value (0-63)"
usage
encode_usage
exit 1
fi
CRF="${OPTARG}"
@@ -278,7 +278,7 @@ set_encode_opts() {
if [[ ! -f ${INPUT} ]]; then
echo "${INPUT} does not exist"
efg_usage
encode_usage
return 1
fi

View File

@@ -103,18 +103,26 @@ dump_arr() {
}
has_cmd() {
local cmd="$1"
command -v "${cmd}" >/dev/null 2>&1
local cmds=("$@")
local rv=0
for cmd in "${cmds[@]}"; do
command -v "${cmd}" >/dev/null 2>&1 || rv=1
done
return ${rv}
}
missing_cmd() {
local cmd="$1"
rv=1
if ! has_cmd "${cmd}"; then
echo_warn "missing ${cmd}"
rv=0
fi
return $rv
local cmds=("$@")
local rv=1
for cmd in "${cmds[@]}"; do
if ! has_cmd "${cmd}"; then
echo_warn "missing ${cmd}"
rv=0
fi
done
return ${rv}
}
bash_dirname() {