aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2026-05-29 07:57:08 +0200
committerDennis Fink2026-05-29 23:29:44 +0200
commit0d2d0535c9eada6beb928e57ac8f992801f00602 (patch)
treee07f6194cdecc2518233eaf94e6cbb04a531f4c1
parent1f25fa369061a7dd1796d2f4def7242d4cb9ca2f (diff)
downloadtranscode.sh-0d2d0535c9eada6beb928e57ac8f992801f00602.tar.gz
transcode.sh-0d2d0535c9eada6beb928e57ac8f992801f00602.zip
refactor(utils): use long option names
Replace short GNU option forms with their long equivalents in utility and cleanup helpers to make option usage more self-documenting while keeping existing BSD/macOS fallbacks unchanged where needed.
Diffstat (limited to '')
-rwxr-xr-xtranscode.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/transcode.sh b/transcode.sh
index 5e82fa1..e7c0a99 100755
--- a/transcode.sh
+++ b/transcode.sh
@@ -403,13 +403,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" \
# Return the size of a file in bytes.
# Uses GNU stat -c on Linux with a fallback to BSD/macOS stat -f.
function filesize() {
- stat -c "%s" -- "$1" 2>/dev/null || stat -f "%z" -- "$1"
+ stat --format="%s" -- "$1" 2>/dev/null || stat -f "%z" -- "$1"
}
# Resolve a symlink (or plain path) to its canonical absolute path.
# Uses readlink -f (GNU) with a fallback to realpath for macOS/BSD.
function resolve_path() {
- readlink -f -- "$1" 2>/dev/null || realpath -- "$1"
+ readlink --canonicalize -- "$1" 2>/dev/null || realpath -- "$1"
}
# Format a byte count into a human-readable IEC size.
@@ -488,7 +488,7 @@ function setup_colors() {
# Outputs the raw string on stdout; returns non-zero if the key is absent or
# tomlq fails for any reason.
function _tomlq_get() {
- tomlq -r "$1" "$CONFIG_FILE" 2>/dev/null
+ tomlq --raw-output "$1" "$CONFIG_FILE" 2>/dev/null
}
# Load configuration from config.toml, respecting CLI precedence.
@@ -777,7 +777,7 @@ function load_preset() {
resolved_file=$(resolve_path "$preset_file")
local preset_perms
- preset_perms=$(stat -c '%a' -- "$resolved_file" 2>/dev/null || stat -f '%OLp' -- "$resolved_file")
+ preset_perms=$(stat --format='%a' -- "$resolved_file" 2>/dev/null || stat -f '%OLp' -- "$resolved_file")
if [[ "${preset_perms: -1}" =~ [2367] ]]; then
error "Preset file is world-writable, refusing to source:" "$resolved_file"
@@ -857,7 +857,7 @@ function list_presets() {
fi
fi
- description=$(sed -n '1s/^[[:space:]]*#[[:space:]]*[Dd]escription:[[:space:]]*//p' "$preset_file")
+ description=$(sed --quiet '1s/^[[:space:]]*#[[:space:]]*[Dd]escription:[[:space:]]*//p' "$preset_file")
if [[ -n "$description" ]]; then
printf "${BOLD}${BLUE}%-${max_name_len}s${ALL_OFF} ${BOLD}${YELLOW}-${ALL_OFF} %s\n" "$preset_name" "$description"
else
@@ -879,7 +879,7 @@ function cleanup() {
for t in "${TEMPORARY_FILES[@]+"${TEMPORARY_FILES[@]}"}"; do
debug "Cleanup temp file:" "$t"
if [[ -f "$t" ]]; then
- rm -f -- "$t"
+ rm --force -- "$t"
fi
done
}