#![feature(or_patterns, map_first_last)]
use clap::{App, Arg};
use std::fs::File;
use std::io::{BufRead, BufReader};
use tudor_sql::todo::Todo;
fn main() {
let matches = App::new("tudor-sql")
.version("0.0.0")
.author("Martino Visintin <martino@visint.in>")
.about("Filters todo.txt files with a SQL-y dialect")
.arg(
Arg::with_name("FILE")
.help("Sets the input file to use")
.required(true)
.index(1),
)
.get_matches();
let input = matches.value_of("FILE").unwrap();
let file = File::open(input).unwrap();
let reader = BufReader::new(file);
for line in reader.lines() {
let l = line.unwrap();
let t = Todo::parse(&l).unwrap();
println!("{}", t);
}
}