23 points by neogoose 10 hours ago | 13 comments
- 100% POSIX and glibc compatible globbing library for C, Zig, and Rust that is faster and supports all the modern globbing formats (more than libc and rust glob crate)
It supports all the formats like * and {a,b} expansion as long as have a very efficient syscall and SIMD optimization for faster processing
- Thanks for sharing. Just curious, is there any way to perform globbing over a list of path-like strings instead of only directly on the filesystem?
- In case someone doesn't know, the standard function for that is called fnmatch:
- Since when `{...}' syntax is a glob pattern? What does `{a,b}/c' produce when there is no directory named `a'?
- Globbing is a matching library. It just means match a/c or b/c if they exist. You should get an iterator of somewhere between zero and two elements.
- would it not just produce 'b/c'? assuming 'b/c' is an existent file path
what else could you justify it doing?
- The behavior of bash would be to produce "a/c" and "b/c", even if both files don't exist
- > The behavior of bash would be to produce "a/c" and "b/c", even if both files don't exist
In bash patterns like {a,b} aren't glob-expansion expansions, they're string operations, and those resolve before glob expansions.
You can confirm this with: ls /{nope,tmp}
- zsh too
- Nice licence, I would've probably used this a few years ago on a project had I known it existed.