Update ft

This commit is contained in:
2026-02-10 15:16:42 +01:00
parent 61b7b53551
commit c1714f29fd

30
bin/ft
View File

@@ -3,4 +3,32 @@ set -e
set -u
set -o pipefail
exec f2 -f "(\w+)[_-](\d\d\d\d)[-]?(\d\d)[-]?(\d\d)[_-](.*)" -r '$2-$3-$4 $5' "$@"
use_exif=false
args=()
while (($#)); do
case "$1" in
-e)
use_exif=true
shift
;;
--)
shift
args+=("$@")
break
;;
*)
args+=("$1")
shift
;;
esac
done
if $use_exif; then
f2 \
-f '{strlen("{x.cdt}") > 0}' \
-r '{x.cdt.YYYY}-{x.cdt.MM}-{x.cdt.DD} {x.cdt.H}-{x.cdt.mm}-{x.cdt.ss} {f}{ext}' \
"${args[@]}"
else
exec f2 -f "(\w+)[_-](\d\d\d\d)[-]?(\d\d)[-]?(\d\d)[_-](.*)" -r '$2-$3-$4 $5' "${args[@]}"
fi