CLI utility to tag file data, contents, and meta data to easily index and search user files.
Adding LICENSE file
Stupid typo cleanup

heads

tip
browse log

clone

read-only
https://hg.code.netlandish.com/~petersanchez/tago
read/write
ssh://hg@hg.code.netlandish.com/~petersanchez/tago

#tago

tago is a command line utility to tag and index files. The idea is to be able to search your indexed files and also organize your files around tags.

Version: 0.1.0

Project Links: Issues - Mailing List - Contributing

Author: Peter Sanchez (https://petersanchez.com)

#Dependencies

  • Go 1.15+ (may work with older, I haven't tried)
  • sqlite 3.9.2+ (with dev files, tago depends on fts5 support)

#Build

  1. Clone repo: hg clone https://hg.code.netlandish.com/~petersanchez/tago
  2. Change into repo dir: cd tago
  3. Build: make all
  4. Install: Just copy the tago binary to wherever you want.

#Usage

The commands are pretty easy and the help for each sub-command will explain how to use them.

$ tago

Tag and index your system files.

Usage:
  tago [command]

Available Commands:
  clear       Clear tag assignments for files and tags
  db          Database operation commands
  delete      Delete files or tags from the database.
  files       List files for the given tag(s).
  help        Help about any command
  merge       Merge old-tag into new-tag; old-tag will be deleted.
  search      Search files for the given term(s).
  stats       List all tags used in the database.
  tag         Tag a file
  tags        List all tags belonging to a file

Flags:
  -d, --database string   Path to SQLite3 database file. (default "~/.tago/tago.db")
  -f, --fullpath          Use full path for all files (disabled relative path display)
  -h, --help              help for tago
  -v, --version           version for tago

Use "tago [command] --help" for more information about a command.

The first thing you need to do is initialize your database:

tago db init

This will create your sqlite database. By default it will go to ~/.tago/tago.db but you can specify the --database flag to specify a different location.

Once initialized you can begin tagging files.

Here's some simple examples:

  • Tag a file: tago tag file.doc tag1 tag2 "longer tag with spaces" tag4
  • Tag and index a file: tago tag --index file.doc tag1 tag2
  • Tag and index a file with description: tago tag --index --desc="Some description of file" file.doc tag1 tag2
  • Tag multiple files with the same tags: tago tag --tags='tag1 tag2 "tag with spaces" tag4' file1.doc file2.doc file3.doc
  • Show files tagged: tago files tag1 tag2
  • Search file index: tago search 'some terms here'
  • Search all text files and tagged with "backup": tago search --ctype=text --tags="backup" 'content search terms here'

You can specify content type for the files and search command. There are also a few shortcuts you can use:

  • Specifically PDF: tago files --ctype=pdf tag1
  • Specific content type: tago files --ctype="application/pdf" tag1

The following content type shortcuts are provided:

  • text
  • pdf
  • image
  • video
  • audio

#Why?

Mainly this is a tool that I wish I had and has been in the back of my mind for some time. Also I started learning Go and wanted a project to help me learn the language.

#Use Cases

There are many different use cases but here are a few examples of what I currently, or plan to, use it for.

  • Search my documents for specific content (useful after I ditched Google Docs)
  • Tag files to be used for backup then query those in my system backup script
  • Read exif data from photos to auto tag based on location
  • Tag my mp3's that are from mix tapes (they're basically impossible to find on streaming services so I manage my mix tapes with a custom system I created).

#Status

Currently all functionality works as expected however there may be some UI changes coming. Mainly around the search and files command. Not sure it makes sense to keep them separate but in the event I do change something there I will keep current commands working until at least a legit version 1 release.

#Roadmap

The goal is to index contents and metadata for an array of files so that it's searchable to easily find files based on a file type + query + tags.

These are the file types I want to index:

  • Plain text (done)
  • PDF (done)
  • Office* Documents (done)
  • Audio file metadata
  • Image metadata

* MS Word and LibreOffice Writer docs are currently supported.

You can see the full list of tasks on the issue tracker.

#Others

I'm aware there are other similar applications out there but I couldn't find any that completely scratched my itch. Especially written in Go. However, there is one notable application that is pretty awesome, and that's TMSU.

#Contributing

We accept patches submitted via hg email which is the patchbomb extension included with Mercurial.

The mailing list where you submit your patches is ~petersanchez/public-inbox@lists.code.netlandish.com. You can also view the archives on the web here:

https://lists.code.netlandish.com/~petersanchez/public-inbox

To quickly setup your clone of tago to submit to the mailing list just edit your .hg/hgrc file and add the following:

[email]
to = ~petersanchez/public-inbox@lists.code.netlandish.com

[patchbomb]
flagtemplate = "tago"

[diff]
git = 1

We have more information on the topic here:

All documentation, libraries, and sample code are Copyright 2020 Peter Sanchez <pjs@petersanchez.com>. The library and sample code are made available to you under the terms of the BSD license which is contained in the included file, LICENSE.