First commit
[ouch.git] / src / main.rs
blob34e9a50690a8b6117ecc7c1625488809c94ea3fd
1 use std::{convert::TryFrom, fs::File};
3 use cli::get_matches;
5 mod cli;
6 mod file;
7 mod extensions;
8 mod error;
10 fn main() {
12     // Just testing
14     // let args: Vec<String> = std::env::args().collect();
16     // let file = std::fs::read(args[1].clone()).unwrap();
18     // match niffler::sniff(Box::new(&file[..])) {
19     //     Ok((reader, compression)) => {},
20     //     Err(err) => {}
21     // }
22     
23     // let (mut reader, compression) = niffler::sniff(Box::new(&file[..])).unwrap();
25     // match compression {
26     //     niffler::Format::Gzip => {}
27     //     niffler::Format::Bzip => {}
28     //     niffler::Format::Lzma => {}
29     //     niffler::Format::No   => {}
30     // }
32     // let mut contents = String::new();
33     // println!("Contents: {}", reader.read_to_string(&mut contents).unwrap());
35     // dbg!(compression);
37     let matches = get_matches();
38     match cli::Command::try_from(matches) {
39         Ok(vals) => { dbg!(vals); },
40         Err(err) => {
41             print!("{}\n", err);
42         }
43     }
44