diff options
| author | Andrew Bagshaw <abagshaw@hotmail.ca> | 2019-03-13 13:50:54 -0700 |
|---|---|---|
| committer | Andrew Bagshaw <abagshaw@hotmail.ca> | 2019-03-13 13:50:54 -0700 |
| commit | 3f114cc0699e2600e92acb466ae2dd90e0626715 (patch) | |
| tree | 215a3835321a02c2ffbebb48b22dae0fa0439bbc /src/verify.rs | |
| parent | abf175111d9bd997bc1c4ef5e078308fad681480 (diff) | |
Start verification at most recently modified file
Diffstat (limited to 'src/verify.rs')
| -rw-r--r-- | src/verify.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/verify.rs b/src/verify.rs index ab08a27..877a2aa 100644 --- a/src/verify.rs +++ b/src/verify.rs @@ -5,10 +5,22 @@ use std::fs; use std::process::Command; use toml::Value; -pub fn verify() -> Result<(), ()> { +pub fn verify(start_at: Option<&str>) -> Result<(), ()> { let toml: Value = fs::read_to_string("info.toml").unwrap().parse().unwrap(); let tomlvec: &Vec<Value> = toml.get("exercises").unwrap().as_array().unwrap(); + let mut hit_start_at = false; + for i in tomlvec { + let path = i.get("path").unwrap().as_str().unwrap(); + + if let Some(start_at) = start_at { + if start_at.ends_with(path) { + hit_start_at = true; + } else if !hit_start_at { + continue; + } + } + match i.get("mode").unwrap().as_str().unwrap() { "test" => test(i.get("path").unwrap().as_str().unwrap())?, "compile" => compile_only(i.get("path").unwrap().as_str().unwrap())?, |
