#[macro_use]
extern crate clap;
extern crate rsstreem;
extern crate rsstreem_parser as parser;

use clap::{App, Arg};
use parser::parse;

use std::error::Error;
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;

fn main() {
    let matches = App::new("rsstreem-language")
        .version(crate_version!())
        .author("everysick <s.wakeup31@gmail.com>")
        .about("Implementation of streem by Rust.")
        .arg(Arg::with_name("file")
                 .short("f")
                 .long("file")
                 .help("Target file for execute"))
        .get_matches();

    // Some code is not verified yet.
    // TODO: parse from FILE
    if let Some(f) = matches.value_of("file") {
        let path = PathBuf::from(f);

        let code = File::open(&path)
            .map_err(|error| String::from(error.description()))
            .and_then(|mut file| {
                          let mut s = String::new();
                          file.read_to_string(&mut s)
                              .map_err(|error| String::from(error.description()))
                              .map(|_| s)
                      })
            .unwrap();

        let ast = parse::parse_code(code.as_ref()).unwrap();
    }
}

extern crate clap;
extern crate rsstreem;
extern crate rsstreem-parser as parser;

use clap::{Arg, App, SubCommand};

use std::error::Error;
use std::io::Read;
use std::fs::File;
use std::path::PathBuf;

const VERSION_MAJOR: u32 = 0;
const VERSION_MINOR: u32 = 1;

fn main() {
    let matches = App::new("rsstreem")
        .version(&format!("v{}.{}", VERSION_MAJOR, VERSION_MINOR))
        .author("everysick <s.wakeup31@gmail.com>")
        .args_from_usage(
            "<INPUT> 'Source code file to compile'
             -d, --debug 'Display debugging information'")
        .get_matches();

    let path = matches.value_of("INPUT")
        .map(PathBuf::from)
        .unwrap();

    let code = File::open(&path)
        .map_err(|error    | String::from(error.description()) )
        .and_then(|mut file| {
            let mut s = String::new();
            file.read_to_string(&mut s)
                .map_err(|error| String::from(error.description()) )
                .map(|_| s)
        })
        .unwrap();
    
    let ast = parser::parser_code(code.as_ref()).unwrap();
    for node in ast { println!("{}", (*node).fmt_string()) }
}

--- 
+++ 
@@ -1,40 +1,42 @@
+#[macro_use]
 extern crate clap;
 extern crate rsstreem;
-extern crate rsstreem-parser as parser;
+extern crate rsstreem_parser as parser;
 
-use clap::{Arg, App, SubCommand};
+use clap::{App, Arg};
+use parser::parse;
 
 use std::error::Error;
+use std::fs::File;
 use std::io::Read;
-use std::fs::File;
 use std::path::PathBuf;
 
-const VERSION_MAJOR: u32 = 0;
-const VERSION_MINOR: u32 = 1;
-
 fn main() {
-    let matches = App::new("rsstreem")
-        .version(&format!("v{}.{}", VERSION_MAJOR, VERSION_MINOR))
+    let matches = App::new("rsstreem-language")
+        .version(crate_version!())
         .author("everysick <s.wakeup31@gmail.com>")
-        .args_from_usage(
-            "<INPUT> 'Source code file to compile'
-             -d, --debug 'Display debugging information'")
+        .about("Implementation of streem by Rust.")
+        .arg(Arg::with_name("file")
+                 .short("f")
+                 .long("file")
+                 .help("Target file for execute"))
         .get_matches();
 
-    let path = matches.value_of("INPUT")
-        .map(PathBuf::from)
-        .unwrap();
+    // Some code is not verified yet.
+    // TODO: parse from FILE
+    if let Some(f) = matches.value_of("file") {
+        let path = PathBuf::from(f);
 
-    let code = File::open(&path)
-        .map_err(|error    | String::from(error.description()) )
-        .and_then(|mut file| {
-            let mut s = String::new();
-            file.read_to_string(&mut s)
-                .map_err(|error| String::from(error.description()) )
-                .map(|_| s)
-        })
-        .unwrap();
-    
-    let ast = parser::parser_code(code.as_ref()).unwrap();
-    for node in ast { println!("{}", (*node).fmt_string()) }
+        let code = File::open(&path)
+            .map_err(|error| String::from(error.description()))
+            .and_then(|mut file| {
+                          let mut s = String::new();
+                          file.read_to_string(&mut s)
+                              .map_err(|error| String::from(error.description()))
+                              .map(|_| s)
+                      })
+            .unwrap();
+
+        let ast = parse::parse_code(code.as_ref()).unwrap();
+    }
 }
Add clap option and ensure that load porogram from input file [wip]
