use opengrep::{search::SearchEngine, Config};
use std::path::PathBuf;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = Config::default();
let engine = SearchEngine::new(config);
let results = engine.search("TODO", &[PathBuf::from(".")]).await?;
for result in results {
println!("Found {} matches in {}", result.matches.len(), result.path.display());
for match_item in result.matches {
println!(" Line {}: {}", match_item.line_number, match_item.line_text.trim());
}
}
Ok(())
}