Finder is a small command-line tool written in Go to locate projects based on predefined folder/file structure templates.
In short: you can search for repositories (e.g. .git), project layouts,
or your own custom structures using templates.
feel free to help the Project by committing Code for the project are Templates. Feel although free to submit Templates via Issues!
- Searches using JSON5 templates stored in
internal/structure/templates. - Supports user templates in the OS-specific configuration folder.
- Lightweight, tested, and easy to extend.
- Finder can although be used to search single files and is a lot faster than Windows Search just to say
- Go 1.18 or newer
Build from source:
go build ./cmd/finderOr install with go install (Go 1.18+):
go install github.com/shadowdara/finder/cmd/finder@latestThe produced binary is finder (on Windows finder.exe).
Basic syntax:
finder <template-name>Example — find Git repositories:
finder gitThe program searches the current directory recursively and prints matches based on the template name.
Default templates are stored in internal/structure/templates.
Templates are JSON5 files with fields such as name, files, and
folders. A simple template to find Git repositories looks like:
// Template for Git
{
"name": "*",
"folders": [{ "name": ".git" }]
}And a full template looks like this. Empty Value are not required
in the Template. The description will be displayed in the program
when searching for the Template and although when displaying all
templates. The command runs in the Structure Directory after the
Structure is found. The Entrywill only be added is the command
returns 0 when invert_command is false, else 1.
// Template for Git
{
"name": "*",
"description": "",
"folders": [{ "name": ".git" }],
"files": [],
"command": "",
"invert_command": false
}Then call finder <template-name> to use them.
In Version v0.3.15 and heigher, finder has a global config in ~/.finder/config.json5. In case the file doesnt exist, it will result in the default config with looks like this:
// And it supports comments
{
"port": 8080,
"cache": true,
// Use git as a database to safe the cache data (maybe cool)
// for stats or etc (idk)
// You dont have to use it obviously
"create_cache_db": false
}For more and detailed Information and more config values check out the config editor here
I thing i would change is to use raw JSON for the templates instead of JSON with comments, which i called JSON5 back then, but it is no real JSON5.
Run tests:
go test ./...Generate coverage report:
go test -coverprofile=coverage ./...
go tool cover -html=coverageBuild:
go build ./cmd/finderCheck the available Templates
go run ./cmd/finder check- Found a missing or inaccurate template? Please open an issue.
- Add new templates via PR. Keep them in JSON5 and provide a short description of what the template matches.
- use temporary Template via the Command Line
- Caching/Indexing for faster searches
- Web UI for template management
- Template schema and validation
See LICENSE.
Project: https://github.com/shadowdara/finder
The Project fs-tools was more or less the prototype for finder.
(a Youtube Video)
