jdberry / tag

A command line tool to manipulate tags on Mac OS X files, and to query for files with those tags.
MIT License
1.47k stars 94 forks source link

Support for Rixtag and other xattr? #33

Open JayBrown opened 7 years ago

JayBrown commented 7 years ago

Rixstep has released a new super-fast tagging app called Rixtag using proprietary xattr, not the default macOS tags: http://rixstep.com/1/20170808,00.shtml The xattr is com.rixstep.Rixtag, and the tags are stored in binary plist as hex data.

Support possible? E.g. as tag --xattr=com.rixstep.Rixtag <option> <tag(s)> <path(s)>

In that regard, wouldn't it be easy to let users create their own xattr? E.g.: tag --xattr=com.github.jdberry -a <tag(s)> <path(s)> and so on…

JayBrown commented 7 years ago

PS: judging from this comment on stackoverflow, Spotlight does recognize proprietary xattr tags, as long as they conform to com.apple.metadata:MyPersonalXattrString. So I assume the latter portion, i.e. tag --xattr=com.apple.metadata:MyPersonalXattrString <option> <tag(s)> <path(s)> should be easy to implement.

As for supporting com.rixstep.Rixtag, that would be harder. The following ones…

tag -a | --add <tags> <path>...     Add tags to file
tag -r | --remove <tags> <path>...  Remove tags from file
tag -s | --set <tags> <path>...     Set tags on file
tag -l | --list <path>...           List the tags on file

…could work—it's even possible to do it with a shell script using xxd or hexdump plus plutil and xattr, of course—, but the following…

tag -m | --match <tags> <path>...   Display files with matching tags
tag -f | --find <tags> <path>...    Find all files with tags, limited to paths if present

…probably would not work out of the box, because Spotlight/macOS wouldn't recognize the xattr com.rixstep.Rixtag. So tags would have to traverse down the given path and check every file for that xattr, which would surely be very slow, too slow.

jdberry commented 7 years ago

Hi @JayBrown. It could certainly be done, but I won't guarantee I'll be motivated to make a change here for your case. Note that --match already does do an exhaustive recursive search for files with the given tags.