Skip to content

Commit 0dc670f

Browse files
authored
Added a simple usage section
1 parent 8e073be commit 0dc670f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- [Quick Start](#quick-start)
1212
* [Build Library and Standalone Sample](#build-library-and-standalone-sample)
13+
- [Usage](#usage)
1314
- [API](#api)
1415
- [Wildcards](#wildcards)
1516
- [Examples](#examples)
@@ -40,6 +41,25 @@ cmake --build build
4041
./build/standalone/glob --help
4142
```
4243

44+
### Usage
45+
46+
```cpp
47+
// Match on a single pattern
48+
for (auto& p : glob::glob("*.png")) {
49+
// do something with `p`
50+
}
51+
52+
// Match on multiple patterns
53+
for (auto& p : glob::glob({"*.png", "*.jpg"})) {
54+
// do something with `p`
55+
}
56+
57+
// Match recursively
58+
for (auto& p : glob::rglob("**/*.hpp")) {
59+
// do something with `p`
60+
}
61+
```
62+
4363
## API
4464

4565
* No tilde expansion is done but `*`, `?`, and character ranges expressed with `[]` will be correctly matched.

0 commit comments

Comments
 (0)