grss 0.1.0

A tool to search files
Documentation
use structopt::StructOpt;
use failure::ResultExt;
use exitfailure::ExitFailure;
//use std::{thread, time};

#[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))?;

    grss::find_matches(&content, &args.pattern, &mut std::io::stdout());

//    let pb = indicatif::ProgressBar::new(100);
//    for i in 0..100 {
//        pb.println(format!("[+] finished #{}", i));
//        thread::sleep(time::Duration::from_millis(100));
//        pb.inc(1);
//    }
//    pb.finish_with_message("done");

    Ok(())

}