#[macro_use]
extern crate brev;
extern crate clap;
extern crate regex;

use clap::{App, Arg};
use regex::Regex;
use std::collections::HashSet;
use std::io::prelude::*;
use std::{fs, io};

fn main() {
  let matches = App::new("nomi")
    .version(concat!("v", env!("CARGO_PKG_VERSION")))
    .author("Casey Rodarmor <casey@rodarmor.com>")
    .about("summarize repetitive text - https://github.com/casey/nomi")
    .arg(Arg::with_name("input")
         .multiple(true)
         .help("input files to read"))
    .get_matches();

  let stdin = io::stdin();
  let mut files = vec![];

  if let Some(inputs) = matches.values_of("input") {
    for path in inputs {
      match fs::File::open(path) {
        Ok(file)   => files.push(file),
        Err(error) => die!("io error opening `{}`: {}", path, error),
      }
    }
  }

  let mut readers = vec![];

  for file in &files {
  }

  // let mut seen  = HashSet::new();
  // let     re    = Regex::new("[0-9]+").unwrap();
  // let     stdin = io::stdin();

  // for result in stdin.lock().lines() {
  //   let line = result.unwrap();
  //   let summary = re.replace_all(&line, "");
  //   if !seen.contains(&summary) {
  //     seen.insert(summary);
  //     println!("{}", line);
  //   }
  // }
}
