mod structs;
use std::fs::read_to_string;
use std::io::stdout;
use crate::structs::cli::Cli;
use clap::Parser;
use anyhow::{Context, Result};
use grps::find_matches;
fn main() -> Result<()> {
let args = Cli::parse();
let content = read_to_string(&args.path)
.with_context(|| format!("Could not read file `{}`", &args.path.display()))?;
find_matches(&content, &args.pattern, &mut stdout())
.with_context(|| "Failed to write results to stdout")?;
Ok(())
}