smallgrep 0.1.1

A Lite version of a CLI tool grep made with rust
Documentation
# smallgrep

`smallgrep` is a lightweight, beginner-friendly implementation of the classic
Unix `grep` command, written in Rust 🦀.

This project is designed primarily as a **learning crate**, focusing on:

- idiomatic Rust
- clean CLI design
- correctness over cleverness
- understanding how real CLI tools are built and published

---

## ✨ Features

- 🔍 Case-sensitive search (default)
- 🔡 Case-insensitive search (`-i`, `--insensitive`)
- 🎯 Exact (whole-word) matching (`-e`,`--exact`)
- 🎨 Optional colorized output (`-c`,`--colorize`)
- 📄 Simple, readable codebase
- 📚 Well-documented with examples and tests

---

## Installation

Install the binary using Cargo:

```
cargo install smallgrep
```

---

## Usage

```
smallgrep <QUERY> <FILENAME> [OPTIONS]
```

### Positional Arguments

- QUERY  
  The word or pattern to search for.

- FILENAME  
  The file to search in.

### Options

- -i, --insensitive  
  Perform a case-insensitive search.

- --exact  
  Match the query as a whole word only.

- --colorize  
  Highlight matched text with color.

- -h, --help  
  Show help information.

- -V, --version  
  Show version information.

---

## Examples

### Basic case-sensitive search

```
smallgrep hello file.txt
```

Matches lines containing `hello` exactly as written.

---

### Case-insensitive search

```
smallgrep hello file.txt -i
```

Matches:

```
hello
Hello
HELLO
```

---

### Exact (whole-word) matching

```
smallgrep cat file.txt --exact
```

Matches:

```
cat
the cat sat
(cat)
```

Does NOT match:

```
concatenate
bobcat
```

---

### Exact and case-insensitive matching

```
smallgrep cat file.txt --exact -i
```

Matches:

```
Cat
cAt
CAT
```

Only when `cat` appears as a whole word.

---

### Colorized output

```
smallgrep error log.txt --colorize
```

Highlights matched words in color when output is printed to a terminal.

Note: Colors are automatically disabled when output is redirected to a file.

---

### Combining multiple options

```
smallgrep rust README.md --exact -i --colorize
```

---

## Documentation

- API docs: [https://docs.rs/smallgrep/latest]https://docs.rs/smallgrep/latest
- Crate page: [https://crates.io/crates/smallgrep]https://crates.io/crates/smallgrep

---

## License

Licensed under either of:

- MIT License
- Apache License, Version 2.0