tree_sitter_grep_ignore

Crates.iotree_sitter_grep_ignore
lib.rstree_sitter_grep_ignore
version0.4.20-dev.0
sourcesrc
created_at2023-07-12 16:45:56.683263
updated_at2023-07-12 16:45:56.683263
description(A forked version of `ignore` used internally by `tree-sitter-grep`) A fast library for efficiently matching ignore files such as `.gitignore` against file paths.
homepagehttps://github.com/BurntSushi/ripgrep/tree/master/crates/ignore
repositoryhttps://github.com/BurntSushi/ripgrep/tree/master/crates/ignore
max_upload_size
id914624
size248,890
Julian Rosse (helixbass)

documentation

https://docs.rs/ignore

README

ignore

The ignore crate provides a fast recursive directory iterator that respects various filters such as globs, file types and .gitignore files. This crate also provides lower level direct access to gitignore and file type matchers.

Build status

Dual-licensed under MIT or the UNLICENSE.

Documentation

https://docs.rs/ignore

Usage

Add this to your Cargo.toml:

[dependencies]
ignore = "0.4"

Example

This example shows the most basic usage of this crate. This code will recursively traverse the current directory while automatically filtering out files and directories according to ignore globs found in files like .ignore and .gitignore:

use ignore::Walk;

for result in Walk::new("./") {
    // Each item yielded by the iterator is either a directory entry or an
    // error, so either print the path or the error.
    match result {
        Ok(entry) => println!("{}", entry.path().display()),
        Err(err) => println!("ERROR: {}", err),
    }
}

Example: advanced

By default, the recursive directory iterator will ignore hidden files and directories. This can be disabled by building the iterator with WalkBuilder:

use ignore::WalkBuilder;

for result in WalkBuilder::new("./").hidden(false).build() {
    println!("{:?}", result);
}

See the documentation for WalkBuilder for many other options.

Commit count: 1972

cargo fmt