Problem statement
June 12, 2025 ยท View on GitHub
Currently I am running into problems with my file system. When my files have multiple attributes (e.g. something is both a rust program and a control algorithm). I am unable to hierarchically organise my files without excessive symlinks which I dislike. I want to be able to tag directories and then search these tags.
Features
- Can add attributes to attributes
- Able to search directories by tag
- Should work on all UNIX based OS's
- CLI
- Tag metadata is bundled inside the tagged directory as
CRTag.tomlsidecar files inside.crtagdirectories - Changes made are pushed out to the filesystem
CRTag must be run inside a directory that contains a CRTagDefinitions.toml which will hold all the tags. The program will attempt to search upwards for these definitions but will error if not found.
All tags can only be ASCII symbols. This is not enforced but the program is not guaranteed to work with other character sets.
Commands
init
crtag init # Will run in the current directory
crtag init <path>
Creates the CRTagDefinitions at the specified path
add
crtag add directoryname <tags>
Adds tags to relevant directory and creates the CRTag.toml if necessary.
Errors if it encounters a unknown tag, tags that are allowable are still added.
find
crtag find <search_terms>
Searches for the tag or its subtags in the CRTag.toml files, down from CRTagDefinitions.toml
After finding matches they are all printed out.
subtag
crtag subtag <supertag> <subtags>
crtag subtag coding rust
crtag subtag languages rust
Tags the relevant tag with the supertag so all searches of the supertag return the tag. A single tag can have multiple supertags and vice versa. This will create the tag and supertag if they do not exist. This is case-sensitive, and errors on tags not being known.
new
crtag new tag1 tag2
Creates new tags
version
crtag version
Prints out the version of crtag that is running
list
crtag list
Prints out all tags and their subtags
File structure
CRTagDefinitions
[coding]
subtags = ["rust"]
version = "1.0.0" # Describes the semantic versioning of the program version that created this tag
[languages]
subtags = ["rust"]
version = "1.0.0"
[rust]
version = "1.0.0"
CRTag
tags = ["rust", "coding"]
version = "1.0.0" # Describes the semantic versioning of the program that tagged this file
Future improvement
If continue with this, I might consider the following
- creating types and associated methods for tag and definitions files instead of a function based method.
- end to end tests of full functionality
- functionality to remove tags, subtags and a tag from a directory
- tag aliases