This is a simple CLI tool which allows you to filter through files in the current directory by a nearly infinite set of criteria.
You simply point the tool at a directory and a rules file, and it will return a list of files that match your criteria.
Rules are defined in plain yaml, and can be as simple or complex as you like. You can filter by file name, directory, extension, content, etc.
This tool is still in development, so you may experience bugs. Once I have implemented all the features I plan to add, I will be focusing on performance and clearer error messages.
On macOS and Linux, you can install the tool using Homebrew:
brew install issy/tap/file-finderYou can download the latest binary from the releases page
To search for files from the current directory, you can run the following command:
file-finder rules.yamlTo search for files from a different directory, you can run the following command:
file-finder rules.yaml -d /path/to/directoryYour rules file will look something like this
rules:
and:
- filename:
endswith: Api.ts
dirpath:
startswith: src/views
content:
contains: "export default"
- filename:
endswith: .md
dirpath:
startswith: docs
content:
contains: "## Usage"Check the examples directory for more examples of rules files. There is also a schema.json file which defines the rules schema, and can be used to validate your rules files. This can be useful in IDEs which support JSON schema validation, such as VSCode.