Skip to content

Commit

Permalink
Merge pull request #42 from pwnxpl0it/fix_41
Browse files Browse the repository at this point in the history
Fix config initalization
  • Loading branch information
pwnxpl0it authored Sep 20, 2024
2 parents bcfda86 + ff405c7 commit fa31a8d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() {
Template::show_info(&Template::parse(&template, true));
}

Template::extract(template, true, &mut keywords, config, json_data);
Template::extract(template, true, &mut keywords, json_data);
} else {
println!(
"{} {}",
Expand Down
4 changes: 2 additions & 2 deletions src/core/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl Config {
config_dir.pop();

//NOTE: maybe templates path should be parsed from config.toml itself??
let templates = config_dir.join("/") + "/templates/";
let templates = config_dir.join("/") + "/templates";

Config {
path: config_path,
Expand Down Expand Up @@ -62,7 +62,7 @@ content = '''
.replace("CONFIGPATH", &self.path)
.replace("TEMPLATES_PATH", &self.templates_path);

Template::extract(sample, false, &mut keywords, self, serde_json::Value::Null);
Template::extract(sample, false, &mut keywords, serde_json::Value::Null);
}

pub fn get_keywords(self) -> HashMap<String, String> {
Expand Down
5 changes: 0 additions & 5 deletions src/core/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,10 @@ impl Template {
template: String,
is_file: bool,
keywords: &mut HashMap<String, String>,
config: Config,
json_data: serde_json::Value,
) {
let re = Regex::new(KEYWORDS_REGEX).unwrap();

if keywords.is_empty() {
*keywords = Keywords::init(config);
}

let sample = Self::parse(&template, is_file);

let files = sample.files;
Expand Down

0 comments on commit fa31a8d

Please sign in to comment.