use structopt::StructOpt; 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 content = std::fs::read_to_string(&args.path) .with_context(|_| format!("could not read file `{}`", args.path.display()))?; grrs_rk::find_matches(&content, &args.pattern, &mut std::io::stdout()); Ok(()) }