| Crate | Kind | Role |
|---|---|---|
| library | Parses |
|
| library | Generic, event-driven depth-first directory walker | |
| binary ( |
Application - wires the libraries and drives the search | |
| binary ( |
Integration verifier - runs |
# 1. Build the search tool cd RustTextFinder cargo build # 2. Search the parent directory for Rust files containing "struct" cargo run -- /P ".." /p "rs" /r "struct" # bash / Unix users - the - prefix works equally well cargo run -- -P ".." -p "rs" -r "struct"
| Option | Argument | Default | Meaning |
|---|---|---|---|
| path | Root directory for the search | ||
| extensions | (all files) | Comma-separated extensions, e.g. |
|
| regex | Regular expression matched against file content | ||
| Recurse into subdirectories | |||
| Hide directories that contain no matching files | |||
| (flag) | off | Print all resolved options before searching | |
| (flag) | off | Print help and exit |
# Find all Rust files containing "impl" under the current directory cargo run -- /P "." /p "rs" /r "impl" # Search text and markdown files for a TODO comment, show all directories cargo run -- /P "." /p "txt,md" /r "TODO" /H false # Verbose output - shows resolved path, patterns, and regex before searching cargo run -- /P ".." /p "rs" /r "fn main" /v
TextFinder ver 1.2.0
=======================
searching path: "../"
patterns: ["rs"]
matching files with regex: "struct"
../RustTextFinder/src
"text_finder.rs"
../RustDirNav/src
"dir_nav_lib.rs"
processed 42 files in 18 dirs
That's all Folks!
pub trait DirEvent {
fn do_dir(&mut self, d: &str);
fn do_file(&mut self, f: &str);
}
cd RustCmdLine && cargo build cd ../RustDirNav && cargo build cd ../RustTextFinder && cargo build cd ../RustTfVerify && cargo build
# RustCmdLine unit tests cd RustCmdLine cargo test -- --show-output # RustDirNav unit tests (must run single-threaded) cd RustDirNav cargo test -- --test-threads=1 --show-output # RustTextFinder unit tests cd RustTextFinder cargo test -- --show-output # Integration verification (requires text_finder binary to be built first) cd RustTextFinder && cargo build cd ../RustTfVerify && cargo run
| Package | Version | Used by | Purpose |
|---|---|---|---|
| 1.7.0 | Compile and match regular expressions |