diff --git a/lib/src/filter/tagged.rs b/lib/src/filter/tagged.rs index 30033112..1d0c10ff 100644 --- a/lib/src/filter/tagged.rs +++ b/lib/src/filter/tagged.rs @@ -203,6 +203,21 @@ impl TaggedFilterer { filter.matches(resolved.to_string_lossy()) } } + ( + Tag::Path { + file_type: Some(ft), + .. + }, + Matcher::FileType, + ) => filter.matches(if ft.is_dir() { + "dir" + } else if ft.is_file() { + "file" + } else if ft.is_symlink() { + "symlink" + } else { + "special" + }), (Tag::FileEventKind(kind), Matcher::FileEventKind) => { filter.matches(format!("{:?}", kind)) } @@ -405,6 +420,7 @@ impl Filter { pub enum Matcher { Tag, Path, + FileType, FileEventKind, Source, Process, diff --git a/lib/src/filter/tagged/parse.rs b/lib/src/filter/tagged/parse.rs index 7b4872a8..d6cae5d1 100644 --- a/lib/src/filter/tagged/parse.rs +++ b/lib/src/filter/tagged/parse.rs @@ -22,6 +22,7 @@ impl FromStr for Filter { alt(( tag_no_case("tag"), tag_no_case("path"), + tag_no_case("type"), tag_no_case("kind"), tag_no_case("source"), tag_no_case("src"), @@ -32,6 +33,7 @@ impl FromStr for Filter { |m: &str| match m.to_ascii_lowercase().as_str() { "tag" => Ok(Matcher::Tag), "path" => Ok(Matcher::Path), + "type" => Ok(Matcher::FileType), "kind" => Ok(Matcher::FileEventKind), "source" => Ok(Matcher::Source), "src" => Ok(Matcher::Source),