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

Method to list all tags in use #1

Closed ctwise closed 11 years ago

ctwise commented 11 years ago

Finder seems to have a fast method for listing all tags in use in the filesystem. It would be very helpful to add support in the 'tags' command. It can be faked (slowly) using 'tag --find * --tags --no-name' and processing the results but a fast, simple method would be extremely useful.

jdberry commented 11 years ago

On Oct 30, 2013, at 10:44 AM, Charles (Ted) Wise notifications@github.com wrote:

Finder seems to have a fast method for listing all tags in use in the filesystem. It would be very helpful to add support in the 'tags' command. It can be faked (slowly) using 'tag --find * --tags --no-name' and processing the results but a fast, simple method would be extremely useful

I have a feeling that finder is doing essentially that… but I could build in a command that would eliminate the post-processing. Finder, of course, may keep some long running queries running, so that it just gets incremental results.

James

ctwise commented 11 years ago

If there's no under-the-hood support available, please don't put yourself out, getting a list of tags is just 'tag --find * --tags --no-name -g | sort -u'. It's speed I was hoping for, not a simpler command-line. But I appreciate it. Thanks for great work, I was limping along with the latest openmeta release before this.

On Wed, Oct 30, 2013 at 2:03 PM, James Berry notifications@github.comwrote:

On Oct 30, 2013, at 10:44 AM, Charles (Ted) Wise notifications@github.com wrote:

Finder seems to have a fast method for listing all tags in use in the filesystem. It would be very helpful to add support in the 'tags' command. It can be faked (slowly) using 'tag --find * --tags --no-name' and processing the results but a fast, simple method would be extremely useful

I have a feeling that finder is doing essentially that… but I could build in a command that would eliminate the post-processing. Finder, of course, may keep some long running queries running, so that it just gets incremental results.

James

— Reply to this email directly or view it on GitHubhttps://github.com/jdberry/tag/issues/1#issuecomment-27419903 .

jdberry commented 11 years ago

I can't think of a way to do this other than to iterate through the files found and uniq their tags, as you're doing. Doing it internally in the tag command would save some extra IO and the sort -u command execution, but I'm not sure it would be a lot faster.

If you want this for use in a front-end application where you want to have the complete set of tags available at any time (as Finder does), I would definitely recommend that you rip off the find command internals from tag, and use those to create a long-running asynchronous query... you can disable the query periodically to read new results. This saves you from having to find all the tags/files each time you want to present that interface.