Change auto op for FEKs to glob

This commit is contained in:
Félix Saparelli 2021-12-18 12:44:40 +13:00
parent ba9d9939d9
commit 159a8a4b2e
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
1 changed files with 3 additions and 4 deletions

View File

@ -93,16 +93,15 @@ impl FromStr for Filter {
on: m,
op: match o {
Op::Auto => match m {
Matcher::Path => Op::Glob,
Matcher::Path | Matcher::FileEventKind => Op::Glob,
_ => Op::InSet,
},
o => o,
},
pat: match (o, m) {
// TODO: carry regex/glob errors through
(Op::Auto | Op::Glob, Matcher::Path) | (Op::Glob | Op::NotGlob, _) => {
Pattern::Glob(p.to_string())
}
(Op::Auto, Matcher::Path | Matcher::FileEventKind)
| (Op::Glob | Op::NotGlob, _) => Pattern::Glob(p.to_string()),
(Op::Auto | Op::InSet | Op::NotInSet, _) => {
Pattern::Set(p.split(',').map(|s| s.trim().to_string()).collect())
}