oih_grrs 0.1.0

A simple grep implementation
Documentation
use structopt::StructOpt;
use std::io::BufReader;
use failure::ResultExt;
use exitfailure::ExitFailure;

#[derive(StructOpt)]
struct Cli {
    /// The patter to look for
    pattern: String,
    /// The path to the file to read
    #[structopt(parse(from_os_str))]
    path: std::path::PathBuf,
}

fn main() -> Result<(), ExitFailure> {
    let args = Cli::from_args();
    let file = std::fs::File::open(&args.path)
        .with_context(|_| format!("could not read file `{}`", args.path.display()))?;
    oih_grrs::find_matches(BufReader::new(file), &args.pattern, std::io::stdout());

    Ok(())
}