Skip to content

Commit 33a2087

Browse files
crates/triggers: Adapt code to the new fnmatch API
1 parent b7069e6 commit 33a2087

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

crates/triggers/src/format.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ impl Handler {
2929
match self {
3030
Handler::Run { run, args } => {
3131
let mut run = run.clone();
32-
for (key, value) in &with_match.variables {
32+
for (key, value) in &with_match.groups {
3333
run = run.replace(&format!("$({key})"), value);
3434
}
3535
let args = args
3636
.iter()
3737
.map(|a| {
3838
let mut a = a.clone();
39-
for (key, value) in &with_match.variables {
39+
for (key, value) in &with_match.groups {
4040
a = a.replace(&format!("$({key})"), value);
4141
}
4242
a
@@ -99,9 +99,9 @@ mod tests {
9999

100100
let (pattern, _) = trigger.paths.iter().next().expect("Missing path entry");
101101
let result = pattern
102-
.match_path("/usr/lib/modules/6.6.7-267.current/kernel")
102+
.matches("/usr/lib/modules/6.6.7-267.current/kernel")
103103
.expect("Couldn't match path");
104-
let version = result.variables.get("version").expect("Missing kernel version");
104+
let version = result.groups.get("version").expect("Missing kernel version");
105105
assert_eq!(version, "6.6.7-267.current", "Wrong kernel version match");
106106
eprintln!("trigger: {trigger:?}");
107107
eprintln!("match: {result:?}");

crates/triggers/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'a> Collection<'a> {
7373
let results = paths.into_iter().flat_map(|p| {
7474
self.handlers
7575
.iter()
76-
.filter_map(move |h| h.pattern.match_path(&p).map(|m| (h.id.clone(), m, h.handler.clone())))
76+
.filter_map(move |h| h.pattern.matches(&p).map(|m| (h.id.clone(), m, h.handler.clone())))
7777
});
7878
self.hits.extend(results);
7979
}

0 commit comments

Comments
 (0)