aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2026-05-22 06:47:44 +0200
committerDennis Fink2026-05-22 06:47:44 +0200
commit7c80b71f628fbe484de645aa4aad775dc0158ed4 (patch)
tree88fe895ce4cee688f2ee620cf23b9edbadfd51a8
parent3e8c51b898eb9cc888a156cb9678ec4c1478cc8d (diff)
downloadtranscode.sh-7c80b71f628fbe484de645aa4aad775dc0158ed4.tar.gz
transcode.sh-7c80b71f628fbe484de645aa4aad775dc0158ed4.zip
refactor(cli): simplify empty value checks
Replace indirect non-empty tests with direct -z checks when validating option values during CLI parsing. This keeps the intent clearer and makes all empty-value guards easier to read without changing the validation behavior.
-rwxr-xr-xtranscode.sh30
1 files changed, 15 insertions, 15 deletions
diff --git a/transcode.sh b/transcode.sh
index 817d8e2..31a2d45 100755
--- a/transcode.sh
+++ b/transcode.sh
@@ -1507,7 +1507,7 @@ while [[ $# -gt 0 ]]; do
error "Missing value for $1"
exit $EXIT_USAGE_ERROR
fi
- if [[ ! -n "$2" ]]; then
+ if [[ -z "$2" ]]; then
error "Value for $1 must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1516,7 +1516,7 @@ while [[ $# -gt 0 ]]; do
shift 2
;;
--backup-dir=*)
- if [[ ! -n "${1#*=}" ]]; then
+ if [[ -z "${1#*=}" ]]; then
error "Value for --backup-dir must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1529,7 +1529,7 @@ while [[ $# -gt 0 ]]; do
error "Missing value for $1"
exit $EXIT_USAGE_ERROR
fi
- if [[ ! -n "$2" ]]; then
+ if [[ -z "$2" ]]; then
error "Value for $1 must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1538,7 +1538,7 @@ while [[ $# -gt 0 ]]; do
shift 2
;;
--config-file=*)
- if [[ ! -n "${1#*=}" ]]; then
+ if [[ -z "${1#*=}" ]]; then
error "Value for --config-file must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1556,7 +1556,7 @@ while [[ $# -gt 0 ]]; do
error "Missing value for $1"
exit $EXIT_USAGE_ERROR
fi
- if [[ ! -n "$2" ]]; then
+ if [[ -z "$2" ]]; then
error "Value for $1 must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1564,7 +1564,7 @@ while [[ $# -gt 0 ]]; do
shift 2
;;
--encode-file=*)
- if [[ ! -n "${1#*=}" ]]; then
+ if [[ -z "${1#*=}" ]]; then
error "Value for --encode-file must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1604,7 +1604,7 @@ while [[ $# -gt 0 ]]; do
error "Missing value for $1"
exit $EXIT_USAGE_ERROR
fi
- if [[ ! -n "$2" ]]; then
+ if [[ -z "$2" ]]; then
error "Value for $1 must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1613,7 +1613,7 @@ while [[ $# -gt 0 ]]; do
shift 2
;;
--size-report-file=*)
- if [[ ! -n "${1#*=}" ]]; then
+ if [[ -z "${1#*=}" ]]; then
error "Value for --size-report-file must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1663,7 +1663,7 @@ while [[ $# -gt 0 ]]; do
--hwaccel=*)
HWACCEL=1
HWACCEL_VALUE="${1#*=}"
- if [[ ! -n "$HWACCEL_VALUE" ]]; then
+ if [[ -z "$HWACCEL_VALUE" ]]; then
error "Value for --hwaccel must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1680,7 +1680,7 @@ while [[ $# -gt 0 ]]; do
error "Missing value for $1"
exit $EXIT_USAGE_ERROR
fi
- if [[ ! -n "$2" ]]; then
+ if [[ -z "$2" ]]; then
error "Value for $1 must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1689,7 +1689,7 @@ while [[ $# -gt 0 ]]; do
shift 2
;;
--preset=*)
- if [[ ! -n "${1#*=}" ]]; then
+ if [[ -z "${1#*=}" ]]; then
error "Value for --preset must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1702,7 +1702,7 @@ while [[ $# -gt 0 ]]; do
error "Missing value for:" "$1"
exit $EXIT_USAGE_ERROR
fi
- if [[ ! -n "$2" ]]; then
+ if [[ -z "$2" ]]; then
error "Value for $1 must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1711,7 +1711,7 @@ while [[ $# -gt 0 ]]; do
shift 2
;;
--ffmpeg-loglevel=*)
- if [[ ! -n "${1#*=}" ]]; then
+ if [[ -z "${1#*=}" ]]; then
error "Value for --ffmpeg-loglevel must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1724,7 +1724,7 @@ while [[ $# -gt 0 ]]; do
error "Missing value for:" "$1"
exit $EXIT_USAGE_ERROR
fi
- if [[ ! -n "$2" ]]; then
+ if [[ -z "$2" ]]; then
error "Value for $1 must not be empty"
exit $EXIT_USAGE_ERROR
fi
@@ -1737,7 +1737,7 @@ while [[ $# -gt 0 ]]; do
shift 2
;;
--video-stream=*)
- if [[ ! -n "${1#*=}" ]]; then
+ if [[ -z "${1#*=}" ]]; then
error "Value for --video-stream must not be empty"
exit $EXIT_USAGE_ERROR
fi