use structopt::StructOpt;
use std::io::BufReader;
use failure::ResultExt;
use exitfailure::ExitFailure;
#[derive(StructOpt)]
struct Cli {
pattern: String,
#[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(())
}