Document the format of the globset tuple arguments (#298)

This commit is contained in:
Félix Saparelli 2022-06-07 11:46:07 +00:00
parent e215e2c09f
commit 557efab1c4
1 changed files with 8 additions and 1 deletions

View File

@ -14,9 +14,12 @@ use crate::ignore::{IgnoreFile, IgnoreFilterer};
/// A path-only filterer based on globsets.
///
/// This filterer mimics the behavior of the `watchexec` v1 filter, but does not match it exactly,
/// due to differing internals. It is intended to be used as a stopgap until the tagged filterer
/// due to differing internals. It is intended to be used as a stopgap until the "tagged" filterer
/// or another advanced filterer, reaches a stable state or becomes the default. As such it does not
/// have an updatable configuration.
///
/// While it is experimental, the ["tagged" filterer](crate::filter::tagged) is generally easier
/// and more intuitive to use in code for new applications.
#[derive(Debug)]
pub struct GlobsetFilterer {
origin: PathBuf,
@ -33,6 +36,10 @@ impl GlobsetFilterer {
/// second is used to ignore paths (matching paths will fail the pattern). If the filter list is
/// empty, only the ignore list will be used. If both lists are empty, the filter always passes.
///
/// Ignores and filters are passed as a tuple of the glob pattern as a string and an optional
/// path of the folder the pattern should apply in (e.g. the folder a gitignore file is in).
/// A `None` to the latter will mark the pattern as being global.
///
/// The extensions list is used to filter files by extension.
///
/// Non-path events are always passed.