| Crates.io | wrep |
| lib.rs | wrep |
| version | 0.1.1 |
| created_at | 2025-11-18 06:17:33.801846+00 |
| updated_at | 2025-11-18 06:54:53.773405+00 |
| description | A tool to search files |
| homepage | https://github.com/Shen0000/wrep |
| repository | https://github.com/Shen0000/wrep |
| max_upload_size | |
| id | 1937945 |
| size | 35,123 |
A simple and fast command-line tool to search for patterns in files, inspired by grep. Adapted from Command Line Applications in Rust
wrep is a lightweight file search utility written in Rust that allows you to search for text patterns within files. It reads a file and displays all lines that contain the specified pattern.
Clone the repository and build with Cargo:
git clone https://github.com/Shen0000/wrep
cd wrep
cargo build --release
The compiled binary will be available at target/release/wrep.
cargo install wrep
wrep <PATTERN> <FILE>
<PATTERN> - The text pattern to search for<FILE> - The path to the file to search inSearch for the word "error" in a log file:
wrep error /var/log/app.log
Search for "TODO" in a source file:
wrep TODO src/main.rs
wrep outputs all lines from the file that contain the search pattern. Each matching line is printed to stdout exactly as it appears in the file.
If the specified file doesn't exist or cannot be read, wrep will display an error message:
Error: could not read file `<filepath>`
Run the unit tests:
cargo test
Run integration tests:
cargo test --test cli
src/main.rs - Command-line interface and argument parsing
src/lib.rs - Core pattern matching logic
tests/cli.rs - Integration tests
MIT