项目作者: goelhardik

项目描述 :
.gitignore based parser implemented in C# according to the .gitignore spec 2.29.2.
高级语言: C#
项目地址: git://github.com/goelhardik/ignore.git
创建时间: 2020-12-08T03:04:53Z
项目社区:https://github.com/goelhardik/ignore

开源协议:MIT License

下载


Ignore

Build
codecov
NuGet

.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.

  1. Install-Package Ignore

Usage

  1. // Initialize ignore
  2. var ignore = new Ignore();
  3. // Add a rule
  4. ignore.Add(".vs/");
  5. // Add multiple rules
  6. ignore.Add(new[] { "*.user", "obj/*" });
  7. // Add rules fluently
  8. ignore
  9. .Add(".vs/")
  10. .Add(new[] { "*.user", "obj/*" });
  11. // Filter paths to exclude paths ignored as per the rules
  12. var filteredFiles = ignore.Filter(new[] { ".vs/a.txt", "x.user", "obj/a.dll" });
  13. // Check if a path is ignored
  14. 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

  1. dotnet build

Test

From the root directory

  1. dotnet test