blob: 6774ec7f766e62f174467274ec8156a8ff7ef7f4 (
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
|
use std::fs::File;
use std::io::BufReader;
use std::path::Path;
extern crate clap;
use clap::{load_yaml, App};
extern crate rustc_serialize;
use rustc_serialize::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 = parse(BufReader::new(file));
println!("{}", json::as_pretty_json(&data));
}
_ => panic!("Error File!"),
};
}
|