diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index db517d1..f5abb69 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ mod barbfile; mod executor; use jsonformat::{format_json, Indentation}; +use std::slice::Iter; use barbfile::BarbFile; use executor::{Context, Executor}; @@ -42,14 +43,16 @@ impl Args { pub fn req_headers(&self) -> bool { self.all_headers } -} -fn main() { - let args = Args::parse(); + pub fn files_iter(&self) -> Iter<String> + { + self.files.iter() + } +} - let mut executor = Executor::new(Context::new(env::vars())); +fn run_file(args: &Args, executor: &mut Executor, file_name: &String) { let bfile = BarbFile::from_str( - fs::read_to_string("test.barb") + fs::read_to_string(file_name.as_str()) .expect("Failed to read file") .as_str(), ) @@ -80,3 +83,13 @@ fn main() { ); } } + +fn main() { + let args = Args::parse(); + + let mut executor = Executor::new(Context::new(env::vars())); + + for file in args.files_iter() { + run_file(&args, &mut executor, &file); + } +} |