Skip to content

Commit c943499

Browse files
crates/triggers: Adapt code to the new fnmatch API
1 parent 4f2fb7b commit c943499

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

crates/triggers/src/format.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ impl Handler {
3838
match self {
3939
Handler::Run { run, args } => {
4040
let mut run = run.clone();
41-
for (key, value) in &with_match.variables {
41+
for (key, value) in &with_match.groups {
4242
run = run.replace(&format!("$({key})"), value);
4343
}
4444
let args = args
4545
.iter()
4646
.map(|a| {
4747
let mut a = a.clone();
48-
for (key, value) in &with_match.variables {
48+
for (key, value) in &with_match.groups {
4949
a = a.replace(&format!("$({key})"), value);
5050
}
5151
a
@@ -108,9 +108,9 @@ mod tests {
108108

109109
let (pattern, _) = trigger.paths.iter().next().expect("Missing path entry");
110110
let result = pattern
111-
.match_path("/usr/lib/modules/6.6.7-267.current/kernel")
111+
.matches("/usr/lib/modules/6.6.7-267.current/kernel")
112112
.expect("Couldn't match path");
113-
let version = result.variables.get("version").expect("Missing kernel version");
113+
let version = result.groups.get("version").expect("Missing kernel version");
114114
assert_eq!(version, "6.6.7-267.current", "Wrong kernel version match");
115115
eprintln!("trigger: {trigger:?}");
116116
eprintln!("match: {result:?}");

crates/triggers/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'a> Collection<'a> {
6666
let results = paths.into_iter().flat_map(|p| {
6767
self.handlers
6868
.iter()
69-
.filter_map(move |h| h.pattern.match_path(&p).map(|m| (h.id.clone(), h.handler.compiled(&m))))
69+
.filter_map(move |h| h.pattern.matches(&p).map(|m| (h.id.clone(), h.handler.compiled(&m))))
7070
});
7171

7272
for (id, handler) in results {

0 commit comments

Comments
 (0)