Creating a comprehensive README for your GitHub repository is crucial for helping users understand your code, its purpose, and how to use it effectively. Below, I've provided a template for your README based on your code and the options you've implemented. Remember to replace placeholders with actual content:
This is a versatile text search tool developed in Rust that allows you to search for specific patterns in files and directories. It offers various search options, including case-insensitive searching, non-matching results, and the ability to search within directories.
- Search for patterns in files and directories.
- Option for case-insensitive searching.
- Find files that do not match the specified pattern.
- Search within directories and their contents.
- Define search depth within directories.
- Parallel searching using multiple threads.
- Utilizes the regex and walkdir crates.
- Easy-to-use command-line interface.
Before using this tool, ensure you have the following prerequisites:
- Rust and Cargo: Installation Instructions
- Git: Installation Instructions
Clone the repository and build the tool using the following commands:
git clone https://github.com/yourusername/text-search-tool.git
cd text-search-tool
cargo build --release
Run the tool with the desired options:
cargo run [OPTIONS] PATTERN [FILE/DIRECTORY]
The tool supports various options that customize your search. These options are specified as environment variables:
IC
: Perform case-insensitive searching.NON
: Find files and lines that do not match the pattern.DIR
: Search inside directories and find only files with the pattern.IN
: Search inside files found in directories.DPT:[1..n]
: Specify the search depth through directories (default is 1).TH
: Enable parallel searching.NT:[1..n]
: Specify the number of threads for parallel searching (default is 6).
Search for the pattern "example" in a file:
cargo run example path/to/yourfile.txt
Perform a case-insensitive search for "example" in a file:
IC=1 cargo run example path/to/yourfile.txt
Find lines in a file that do not contain "example":
NON=1 cargo run example path/to/yourfile.txt
Search for files containing "example" within a directory:
DIR=1 cargo run example path/to/yourdirectory
Search inside files found in directories:
IN=1 cargo run example path/to/yourdirectory
Enable parallel searching with a specified number of threads:
TH=1 NT:4 cargo run example path/to/yourdirectory