Splitting up some code

In preparation for splitting schala into crates
This commit is contained in:
greg 2017-10-23 20:51:08 -07:00
parent 98e1a5235a
commit 910522537c
2 changed files with 6 additions and 2 deletions

View File

@ -41,6 +41,10 @@ fn main() {
Box::new(maaru_lang::Maaru::new()), Box::new(maaru_lang::Maaru::new()),
Box::new(robo_lang::Robo::new()), Box::new(robo_lang::Robo::new()),
]; ];
schala_main(languages);
}
fn schala_main(languages: Vec<Box<ProgrammingLanguageInterface>>) {
let option_matches = program_options().parse(std::env::args()).unwrap_or_else(|e| { let option_matches = program_options().parse(std::env::args()).unwrap_or_else(|e| {
println!("{:?}", e); println!("{:?}", e);
@ -60,7 +64,7 @@ fn main() {
} }
if option_matches.opt_present("webapp") { if option_matches.opt_present("webapp") {
webapp::web_main(); webapp::web_main(languages);
exit(0); exit(0);
} }

View File

@ -38,6 +38,6 @@ fn interpreter_input(input: Json<Input>) -> Json<Output> {
Json(Output { text: code_output.to_string() }) Json(Output { text: code_output.to_string() })
} }
pub fn web_main() { pub fn web_main(languages: Vec<Box<ProgrammingLanguageInterface>>) {
rocket::ignite().mount("/", routes![index, js_bundle, interpreter_input]).launch(); rocket::ignite().mount("/", routes![index, js_bundle, interpreter_input]).launch();
} }