diff --git a/bin/ft b/bin/ft index 3cb3a8f..910282e 100755 --- a/bin/ft +++ b/bin/ft @@ -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