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}" INPUT="${OPTARG}"
;; ;;
p) p)
missing_cmd gnuplot && return 1
PLOT=true PLOT=true
;; ;;
l) l)

View File

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

View File

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