gi
git_ignore
cargo install git_ignore
gi

git_ignore

Implementation of .gitignore file parsing and glob testing in Rust.

by Nathan Kleyn

0.1.2 (see all)License:MIT OR Apache-2.0
cargo install git_ignore
Readme

gitignore.rs Tests Crates.io Version Of gitignore

This is an implementation of .gitignore parsing and matching in Rust. Use this library if you want to check whether a given path would be excluded by a .gitignore file.

It currently builds on both nighly and stable versions of Rust.

Usage

The crate is called gitignore and you can it is available via crates.io:

[dependencies]
gitignore = "x.y.z"

You can also use the Git version directory simply by depending on it via Cargo:

[dependencies.gitignore]
git = "https://github.com/nathankleyn/gitignore.rs.git"

There are some useful bundled binaries which you can view to see how you might apply this library. The Rust docs are available to view as well.

Examples

A simple example is as follows:

// Create a file
let file = gitignore::File::new(&path_to_gitignore).unwrap();

// This returns a bool as to whether the file matches a rule in the .gitignore file.
file.is_excluded(&path).unwrap();

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

GitHub Stars

37

LAST COMMIT

1yr ago

MAINTAINERS

1

CONTRIBUTORS

7

OPEN ISSUES

7

OPEN PRs

1
VersionTagPublished
0.1.2
6yrs ago
0.1.1
7yrs ago
0.1.0
7yrs ago
No alternatives found
No tutorials found
Add a tutorial