1
0
Fork 0
dotfiles/.config/zsh/functions/reactiontag

22 lines
462 B
Bash
Executable File

#!/usr/bin/env zsh
# tag reaction images/videos using extended attributes
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
if [[ ! -v 1 ]]; then
print -u 2 "usage: ${0} <FILE>"
return 1
fi
file=${1}
zmodload zsh/attr
read -r '?source: ' source
zsetattr ${file} user.source ${source}
tmpfile==()
print "enter description, save and exit editor" > ${tmpfile}
eval ${VISUAL} ${tmpfile}
zsetattr ${file} user.description "$(<${tmpfile})"
rm ${tmpfile}