mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-13 07:41:11 +01:00
Support the COMMON_PATH variant of the event summariser
This commit is contained in:
parent
30abed3fb2
commit
5d2f2fcf62
1 changed files with 18 additions and 3 deletions
|
@ -115,10 +115,19 @@ where
|
|||
_ => "OTHERWISE_CHANGED",
|
||||
}))
|
||||
.or_insert_with(Vec::new)
|
||||
.extend(paths.into_iter().map(|p| p.into_os_string()));
|
||||
.extend(paths.into_iter().map(|p| {
|
||||
if let Some(suffix) = common_path
|
||||
.as_ref()
|
||||
.and_then(|prefix| p.strip_prefix(prefix).ok())
|
||||
{
|
||||
suffix.as_os_str().to_owned()
|
||||
} else {
|
||||
p.into_os_string()
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
grouped_buckets
|
||||
let mut res: HashMap<&'static OsStr, OsString> = grouped_buckets
|
||||
.into_iter()
|
||||
.map(|(kind, paths)| {
|
||||
let mut joined =
|
||||
|
@ -133,5 +142,11 @@ where
|
|||
|
||||
(kind, joined)
|
||||
})
|
||||
.collect()
|
||||
.collect();
|
||||
|
||||
if let Some(common_path) = common_path {
|
||||
res.insert(OsStr::new("COMMON_PATH"), common_path.into_os_string());
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue