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
Configstruct handles argument parsing and configuration.runfunction executes the main logic.searchandsearch_case_insensitiveperform line matching.
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
queryincontents. - search_
case_ insensitive - Performs a case-insensitive search of
queryincontents.