Tagsearch - Search for, and/or summarise, tags in plaintext files.

Introduction

This finds all instances of @ALPHANUMERIC (e.g. roughly matches the regex @[a-zA-Z0-9]) across .txt and .md recursively under the current directory.

The purpose of this script is to basically let me manage information in plaintext much more easily. I've added a separate file giving [a rough overview of how I apply it to different usecases][].

Motivation

A prime motivation was to move away from more commercial software. Even though I can afford to use a few subscription services, I feel like it's better to simplify my processes down. This has multiple benefits:

The main bit of commercial software I still use is Dropbox, so I can get information across all my devices without having to worry about doing things like syncing git. I do however have a cronjob which backs up this information to git. One change this makes to my process is using the file extension .txt instead of .md for my markdown files; this simply lets me utilise Dropbox's full-text search from the web or android app to find information when I don't have access to a terminal and my own helper scripts.

Installation

Download the repo

git clone git@github.com:Chrisdavison/tagsearch

Change to the repo directory

cd tagsearch

Build and install

cargo install --path . --force

Dependencies

regex = "1"
glob = "0.3.0"
lazy_static = "1.4.0"
structopt = "0.3.3"

Usage

Current usage string:

tagsearch 0.9.0
search for, and/or summarise, tags in plaintext files

USAGE:
    tagsearch [FLAGS] [keywords]...

FLAGS:
    -h, --help         Prints help information
    -l, --list         List all tags for files matching keywords
        --long         Long list (e.g. tall) all tags for files matching keywords
    -o, --or-filter    Filter using ANY, rather than ALL keywords
    -u, --untagged     Show untagged files
    -V, --version      Prints version information

ARGS:
    <keywords>...    Keywords to filter by (prefix with ! for negative-match)

Unimplemented (as of yet), after change to rust:

-n, --numeric    When listing, sort by number of tags, and show number
-s, --summarise  List tags and matching files

Examples

tagsearch                 # defaults to -l|--long
tagsearch --long          # to show a tall list of tags
tagsearch golang          # Show files tagged 'golang'
tagsearch -l golang       # List all tags associated with files tagged 'golang'
tagsearch rust '!video'   # Show files tagged 'rust', but NOT tagged 'video'
tagsearch --OR spanish espanol   # Show files that match spanish OR espanol

Note that you must wrap not-filters in quotes, as shells often do something special with !