Skip to content

Commit 5d24d97

Browse files
committed
wildmatch: 🌅
0 parents  commit 5d24d97

File tree

5 files changed

+1201
-0
lines changed

5 files changed

+1201
-0
lines changed

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018- GitHub, Inc. and Git LFS contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# wildmatch
2+
3+
package `wildmatch` is a reimplementation of Git's `wildmatch.c`-style filepath pattern matching.
4+
5+
For more information, see the [godoc][1].
6+
7+
[1]: https://godoc.org/github.com/git-lfs/wildmatch

package.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// package Wildmatch is an implementation of Git's wildmatch.c-style pattern
2+
// matching.
3+
//
4+
// Wildmatch patterns are comprised of any combination of the following three
5+
// components:
6+
//
7+
// - String literals. A string literal is "foo", or "foo\*" (matching "foo",
8+
// and "foo\", respectively). In general, string literals match their exact
9+
// contents in a filepath, and cannot match over directories unless they
10+
// include the operating system-specific path separator.
11+
//
12+
// - Wildcards. There are three types of wildcards:
13+
//
14+
// - Single-asterisk ('*'): matches any combination of characters, any
15+
// number of times. Does not match path separators.
16+
//
17+
// - Single-question mark ('?'): matches any single character, but not a
18+
// path separator.
19+
//
20+
// - Double-asterisk ('**'): greedily matches any number of directories.
21+
// For example, '**/foo' matches '/foo', 'bar/baz/woot/foot', but not
22+
// 'foo/bar'. Double-asterisks must be separated by filepath separators
23+
// on either side.
24+
//
25+
// - Character groups. A character group is composed of a set of included and
26+
// excluded character types. The set of included character types begins the
27+
// character group, and a '^' or '!' separates it from the set of excluded
28+
// character types.
29+
//
30+
// A character type can be one of the following:
31+
//
32+
// - Character literal: a single character, i.e., 'c'.
33+
//
34+
// - Character group: a group of characters, i.e., '[:alnum:]', etc.
35+
//
36+
// - Character range: a range of characters, i.e., 'a-z'.
37+
//
38+
// A Wildmatch pattern can be any combination of the above components, in any
39+
// ordering, and repeated any number of times.
40+
package wildmatch

0 commit comments

Comments
 (0)