From 48e3265ea845437bce4c4895275470e8a1776073 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Wed, 25 Feb 2026 09:14:53 +0100 Subject: fix(cli): improve output consistency and verbose diagnostics Replace the full help page on no-args with a short usage hint to stderr, reserving the full help for explicit -h/--help invocations. Print the active codec skip list at startup under --verbose so unexpected skips can be diagnosed without resorting to DEBUG mode. Include the resolved ffmpeg command in dry-run --verbose output, which is useful for preset authors verifying their ffargs expansion. Fix the only-if-smaller message to follow the "label: value" convention used throughout the script. --- transcode.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/transcode.sh b/transcode.sh index 2866e97..f3b5a4a 100755 --- a/transcode.sh +++ b/transcode.sh @@ -399,7 +399,7 @@ load_preset() { if [[ $# -eq 0 ]]; then debug "No parameters were specified" - print_help + printf "Usage: %s [OPTION] [--] FILE...\nRun '%s --help' for full usage information.\n" "$SCRIPTNAME" "$SCRIPTNAME" >&2 exit $EXIT_USAGE_ERROR fi @@ -579,6 +579,10 @@ if [[ ! "$NICE_VALUE" =~ ^-?[0-9]+$ ]] || ((NICE_VALUE < -20 || NICE_VALUE > 19) exit $EXIT_USAGE_ERROR fi +if [[ ${#SKIP_CODECS[@]} -gt 0 ]]; then + verbose "Skipping files with codecs:" "${!SKIP_CODECS[*]}" +fi + # Remove temporary output files created during encoding. # Registered via trap EXIT so it runs on normal exit and on failures # shellcheck disable=SC2329 @@ -729,6 +733,7 @@ encode_one() { verbose "Input codec:" "$input_codec" verbose "Input pixel format:" "$input_pixel_format" verbose "Output pixel format:" "$output_pixel_format" + verbose "Command:" "${cmd[*]}" return $EXIT_OK fi @@ -743,7 +748,7 @@ encode_one() { # If requested, keep the original if the new file is larger. if [[ $ONLY_IF_SMALLER -eq 1 && $new_filesize -gt $original_filesize ]]; then - msg "Did not replace $file as it was larger than the original." + msg "Did not replace (new file is larger):" "$file" rm -f -- "$tmp" return $EXIT_OK fi -- cgit v1.3.1