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 30 31 32 33 34 35 36 37 38 39 40 41 42
use std::io::{Write, Error}; use std::fs::File; pub fn generate_files(output: &str) -> Result<(), Error> { generate_dig_file(output); generate_python_file(output); generate_sql_file(output); generate_html_file(output); Ok(()) } fn generate_dig_file(output: &str) { let content = include_str!("examples/notification.dig"); let path = output.to_string() + "/notification.dig"; let mut file = File::create(path).unwrap(); write!(file, "{}", content).unwrap(); file.flush().unwrap(); } fn generate_python_file(output: &str) { let content = include_str!("examples/mailchimp.py"); let path = output.to_string() + "/mailchimp.py"; let mut file = File::create(path).unwrap(); write!(file, "{}", content).unwrap(); file.flush().unwrap(); } fn generate_sql_file(output: &str) { let content = include_str!("examples/sample.sql"); let path = output.to_string() + "/sample.sql"; let mut file = File::create(path).unwrap(); write!(file, "{}", content).unwrap(); file.flush().unwrap(); } fn generate_html_file(output: &str) { let content = include_str!("examples/template.html"); let path = output.to_string() + "/template.html"; let mut file = File::create(path).unwrap(); write!(file, "{}", content).unwrap(); file.flush().unwrap(); }