diff --git a/schala-repl/src/lib.rs b/schala-repl/src/lib.rs index 8c8410e..96cb101 100644 --- a/schala-repl/src/lib.rs +++ b/schala-repl/src/lib.rs @@ -1,8 +1,5 @@ #![feature(box_patterns, box_syntax, proc_macro_hygiene, decl_macro)] #![feature(plugin)] -extern crate colored; -extern crate itertools; -extern crate linefeed; #[macro_use] extern crate serde_derive; @@ -13,7 +10,7 @@ extern crate serde_json; use std::collections::HashSet; use std::fs::File; use std::io::Read; -use std::path::Path; +use std::path::PathBuf; use std::process::exit; mod language; @@ -32,16 +29,18 @@ pub fn start_repl(langs: Vec>) { repl.run_repl(); } -//TODO should really expect a list of paths -pub fn run_noninteractive(filename: &str, languages: Vec>) { - let path = Path::new(filename); - let ext = path +pub fn run_noninteractive(filenames: Vec, languages: Vec>) { + // for now, ony do something with the first filename + + let filename = &filenames[0]; + let ext = filename .extension() .and_then(|e| e.to_str()) .unwrap_or_else(|| { - println!("Source file lacks extension"); + println!("Source file `{}` has no extension.", filename.display()); exit(1); }); + let mut language = Box::new( languages .into_iter() @@ -52,7 +51,7 @@ pub fn run_noninteractive(filename: &str, languages: Vec