Awesome
Ignore
.gitignore based parser implemented in C# according to the .gitignore spec 2.29.2.
The library is tested against real git status
outputs. The tests use LibGit2Sharp
for that.
Installation
Ignore can be installed from NuGet.
Install-Package Ignore
Usage
// Initialize ignore
var ignore = new Ignore();
// Add a rule
ignore.Add(".vs/");
// Add multiple rules
ignore.Add(new[] { "*.user", "obj/*" });
// Add rules fluently
ignore
.Add(".vs/")
.Add(new[] { "*.user", "obj/*" });
// Filter paths to exclude paths ignored as per the rules
var filteredFiles = ignore.Filter(new[] { ".vs/a.txt", "x.user", "obj/a.dll" });
// Check if a path is ignored
var isIgnored = ignore.IsIgnored("x.user");
Developing
Ignore targets netstandard2.0
and net8.0
for the main library and uses net6.0
and net8.0
for the unit tests (Xunit).
Build
From the root directory
dotnet build
Test
From the root directory
dotnet test