aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: a8f8e85bb9c081dff97bfb9da9d09f09dd83e374 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use std::fs::File;
use std::io::BufReader;
use std::path::Path;

extern crate clap;
use clap::{load_yaml, App};

#[macro_use]
extern crate serde_derive;
extern crate serde_json;

mod parser;
use parser::*;

fn main() {
	let yaml = load_yaml!("cli/ru.yml");
	let matches = App::from_yaml(yaml).get_matches();

	let path = matches.value_of("FILE").unwrap();

	match Path::new(path).exists() {
		true => {
			let file: File = File::open(path).unwrap();
			let data: ParserResult = parser(BufReader::new(file));
			println!("{:#?}", serde_json::to_string_pretty(&data));
		}
		_ => panic!("Error File!"),
	};
}