From d2866c3f374316a466588180872e7cbab2238829 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Sun, 25 Sep 2022 17:26:27 -0400 Subject: [PATCH] Set source_file on jobs when created from a job file --- src/job.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/job.rs b/src/job.rs index 504c5e2..1f99e49 100644 --- a/src/job.rs +++ b/src/job.rs @@ -16,6 +16,7 @@ pub struct Job { pub last_run: Option, pub output_file: Option, pub channel: Option, + pub source_file: Option, } impl Job { @@ -28,6 +29,7 @@ impl Job { last_run: None, output_file: None, channel: None, + source_file: None, }; } @@ -106,6 +108,7 @@ impl Job { if job.output_file.is_none() { job.set_default_output_file(conf); } + job.source_file = Some(PathBuf::from(path)); return Ok(job); } @@ -208,6 +211,7 @@ selector = section.listing:nth-child(2) > ul:nth-child(1) > li:nth-child(3) > he assert_eq!(job.output_file.unwrap().to_str().unwrap(), "results.d/http:--example.com-test.rss"); assert_eq!(job.every.as_secs(), 7200); assert_eq!(job.selector, "section.listing:nth-child(2) > ul:nth-child(1) > li:nth-child(3) > header:nth-child(3) > h2:nth-child(1) > a:nth-child(1)"); + assert_eq!(job.source_file.unwrap().to_str(), tf.path().to_str()); } }