summaryrefslogtreecommitdiffstats
path: root/rust-cli/grrs/src/main.rs
blob: 09e2d3a7ee1c07450e387267aaba58df42a6bf08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::io::{BufReader, BufRead};
use std::fs::File;
use::clap::Parser;

#[derive(Parser)]
struct Cli {
    pattern: String,
    path: std::path::PathBuf,
}


fn main() {
    let args = Cli::parse();
    //println!("pattern: {}, path: {}",args.pattern, args.path.display());
    let file = File::open(args.path).expect("could not read file");
    let mut reader = BufReader::new(file);
    for line in reader.lines() {
        if line.unwrap_or_default().contains(&args.pattern) {
        }
    }
}