Crate simple_grep

Source
Expand description

ยงSimpleGrep ๐Ÿ•ต๏ธโ€โ™‚๏ธ๐Ÿ“„

simple_grep is a simple command-line tool written in Rust to search for lines that contain a specific query string in a given text file, similar to Unix grep.

It supports both case-sensitive and case-insensitive search based on the IGNORE_CASE environment variable.

ยงExample

cargo run -- <query> <file_path>

Case-insensitive search:

IGNORE_CASE=1 cargo run -- <query> <file_path>

ยงCrate Structure

Structsยง

Config
Holds the configuration parameters for the SimpleGrep application.

Functionsยง

run
Executes the main logic of SimpleGrep: reads the file, searches for the query, and prints matching lines to stdout.
search
Performs a case-sensitive search of query in contents.
search_case_insensitive
Performs a case-insensitive search of query in contents.