Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
rameel committed Jul 15, 2024
1 parent 37b4f61 commit d6fe393
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,39 @@ We use optimizations that prevent quadratic behavior in scenarios like the patte
matching against the text `aaaaaaaaaaaaaaa...aaaa...aaa`.
Similarly, for the `a/**/a/**/a/**/.../a/**/a/**/a/**/b` pattern matching against `a/a/a/a/.../a/.../a`.

## File traversal

The `Files` class provides functionality for traversing the file system and retrieving lists of files and directories based on specified glob patterns. This allows for flexible and efficient file and directory enumeration.

```csharp
using Ramstack.Globbing.Extensions;

// List all *.cs files
var files = Files.EnumerateFiles(@"/path/to/directory", "**/*.cs");
foreach (var file in files)
Console.WriteLine(file);

// List all *.cs files except in tests directory
var files = Files.EnumerateFiles(@"/path/to/directory", "**/*.cs", "tests");
foreach (var file in files)
Console.WriteLine(file);
```
Support for multiple patterns is also included:

```csharp
using Ramstack.Globbing.Extensions;

// List all *.cs files
var files = Files.EnumerateFiles(@"/path/to/directory", ["src/**/*.cs", "lib/**/*.cs"], ["**/tests"]);
foreach (var file in files)
Console.WriteLine(file);
```

## Changelog

### 2.0.0
* Added the ability to retrieve a list of files and directories based on a specified glob pattern.

**BREAKING CHANGE**

To improve code readability and adherence to .NET conventions, the order of parameters in the `IsMatch` method has been changed.
Expand Down

0 comments on commit d6fe393

Please sign in to comment.