No description
Find a file
2025-02-23 18:24:12 +01:00
src fix: create all permutations of depth for tree command 2025-02-23 18:24:12 +01:00
.envrc refactor!: change devShell name 2025-02-23 17:48:16 +01:00
.gitignore feat: cargo init 2025-02-23 15:40:39 +01:00
Cargo.lock faet: add nix package 2025-02-23 17:48:14 +01:00
Cargo.toml faet: add nix package 2025-02-23 17:48:14 +01:00
flake.lock feat: init 2025-02-23 15:36:51 +01:00
flake.nix refactor!: change devShell name 2025-02-23 17:48:16 +01:00
README.md docs: Add comprehensive README with usage, installation, and examples 2025-02-23 17:48:15 +01:00

filetags-rs

A command-line tool for managing tags in file and directory names. Tags are embedded directly in filenames using a specific delimiter pattern.

Installation

This is a nix flake :)

Usage

Tags in filenames use the following format:

filename -- tag1 tag2 tag3.ext

Where:

  • Tag delimiter is -- (space, double dash, space)
  • Tags are separated by spaces
  • Tags are stored in alphabetical order
  • Tags cannot contain spaces, NUL, ":", or "/"

Commands

List Tags

List all unique tags found in the specified files:

filetags list "document -- tag1 tag2.pdf" "notes -- tag2 tag3.txt"
# Output:
# tag1
# tag2
# tag3

Add Tags

Add one or more tags to files:

filetags add --tag=work --tag=draft document.pdf
# Result: document -- draft work.pdf

Remove Tags

Remove specified tags from files:

filetags remove --tag=draft "document -- draft work.pdf"
# Result: document -- work.pdf

Create Tag Tree

Create a directory tree with symlinks based on file tags:

filetags tree --dir=./tagged --depth=2 "document -- tag1 tag2.pdf"

This creates a directory structure like:

tagged/
├── document.pdf -> /path/to/document -- tag1 tag2.pdf
├── tag1/
│   ├── document.pdf -> /path/to/document -- tag1 tag2.pdf
│   └── tag2/
│       └── document.pdf -> /path/to/document -- tag1 tag2.pdf
└── tag2/
    ├── document.pdf -> /path/to/document -- tag1 tag2.pdf
    └── tag1/
        └── document.pdf -> /path/to/document -- tag1 tag2.pdf

Shell Completions

Generate shell completions for your preferred shell:

# For fish shell
filetags completion fish > ~/.config/fish/completions/filetags.fish

# For bash
filetags completion bash > ~/.local/share/bash-completion/completions/filetags

# For zsh
filetags completion zsh > ~/.zsh/completions/_filetags

Error Handling

The tool provides clear error messages for:

  • Invalid characters in tags
  • Empty tags
  • Missing arguments
  • File permission issues
  • Symlink creation failures
  • Directory creation failures

License

GPL-3.0-or-later