Struct gitignore::File [] [src]

pub struct File<'a> { /* fields omitted */ }

Represents a .gitignore file. Use this to load the .gitignore file, parse the patterns, and then check if a given path would be excluded by any rules contained therein.


let file = gitignore::File::new(&gitignore_path).unwrap();


impl<'b> File<'b>

Parse the given .gitignore file for patterns, allowing any arbitrary path to be checked against the set of rules to test for exclusion.

The value of gitignore_path must be an absolute path.

Returns true if, after checking against all the patterns found in the .gitignore file, the given path is matched any of the globs (applying negated patterns as expected). Note this function also returns false if the path does not exist.

If the value for path is not absolute, it will assumed to be relative to the current working directory.

Returns a list of files that are not excluded by the rules in the loaded .gitignore file. It recurses through all subdirectories and returns everything that is not ignored.

Trait Implementations

impl<'a> Debug for File<'a>

Formats the value using the given formatter.