Feat: Create simple grep function.

This commit is contained in:
Ian Rettig
2025-06-06 13:17:01 -04:00
parent 892fd43b53
commit 6e23ccc0cc
+7 -1
View File
@@ -10,5 +10,11 @@ struct Cli {
fn main() {
let args = Cli::parse();
println!("pattern: {:?}, path: {:?}", args.pattern, args.path)
let content = std::fs::read_to_string(&args.path).expect("Could not read file.");
for line in content.lines() {
if line.contains(&args.pattern) {
println!("{}", line)
}
}
}