diff --git a/crates/triggers/src/format.rs b/crates/triggers/src/format.rs index c3fdbcf1..09f5a0e5 100644 --- a/crates/triggers/src/format.rs +++ b/crates/triggers/src/format.rs @@ -29,14 +29,14 @@ impl Handler { match self { Handler::Run { run, args } => { let mut run = run.clone(); - for (key, value) in &with_match.variables { + for (key, value) in &with_match.groups { run = run.replace(&format!("$({key})"), value); } let args = args .iter() .map(|a| { let mut a = a.clone(); - for (key, value) in &with_match.variables { + for (key, value) in &with_match.groups { a = a.replace(&format!("$({key})"), value); } a @@ -99,9 +99,9 @@ mod tests { let (pattern, _) = trigger.paths.iter().next().expect("Missing path entry"); let result = pattern - .match_path("/usr/lib/modules/6.6.7-267.current/kernel") + .matches("/usr/lib/modules/6.6.7-267.current/kernel") .expect("Couldn't match path"); - let version = result.variables.get("version").expect("Missing kernel version"); + let version = result.groups.get("version").expect("Missing kernel version"); assert_eq!(version, "6.6.7-267.current", "Wrong kernel version match"); eprintln!("trigger: {trigger:?}"); eprintln!("match: {result:?}"); diff --git a/crates/triggers/src/lib.rs b/crates/triggers/src/lib.rs index 465331db..85c8fb5c 100644 --- a/crates/triggers/src/lib.rs +++ b/crates/triggers/src/lib.rs @@ -73,7 +73,7 @@ impl<'a> Collection<'a> { let results = paths.into_iter().flat_map(|p| { self.handlers .iter() - .filter_map(move |h| h.pattern.match_path(&p).map(|m| (h.id.clone(), m, h.handler.clone()))) + .filter_map(move |h| h.pattern.matches(&p).map(|m| (h.id.clone(), m, h.handler.clone()))) }); self.hits.extend(results); }