From 08339229db6da6e76726162ba325a625b558cfb6 Mon Sep 17 00:00:00 2001 From: Guillaume Pasquet Date: Sat, 26 Mar 2022 06:22:34 +0000 Subject: Feature/16 dependencies --- src/executor.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/executor.rs') diff --git a/src/executor.rs b/src/executor.rs index 763b0e6..0a6e855 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -2,8 +2,6 @@ use crate::barbfile::{BarbFile, BarbFilter}; use crate::output::BarbOutput; use regex::Regex; use std::collections::HashMap; -use std::fs; -use std::str::FromStr; use ureq; use ureq::Error as UreqError; @@ -16,10 +14,10 @@ impl Context { where I: Iterator, { - let mut toto = HashMap::new(); - toto.extend(vars); + let mut tmp_vars = HashMap::new(); + tmp_vars.extend(vars); - Context { vars: toto } + Context { vars: tmp_vars } } #[cfg(test)] @@ -129,16 +127,10 @@ impl Executor { pub fn execute( &mut self, - file_name: &String, + bfile: &BarbFile, output: &BarbOutput, filter: &Option, ) -> Result<(), String> { - let bfile = BarbFile::from_str( - fs::read_to_string(file_name.as_str()) - .map_err(|_| format!("Failed to read file '{}'", file_name))? - .as_str(), - ) - .map_err(|_| format!("Failed to parse file '{}'", file_name))?; let response = self.run(&bfile, self.make_req(&bfile, output))?; //let response = executor.execute(&bfile, &output)?; -- cgit v1.2.3