Closed WindSoilder closed 2 years ago
I believe Wax is capable of all the behaviors described in the example code. However, the design intentionally avoids exposing some of these behaviors as simple toggles controlled via the API, so some additional code may be required for your use case.
When matching a directory tree via Glob::walk
, the Walk
iterator allows calling code to control the traversal of the file system via filter_tree
. Unlike toggles, this filtering is arbitrary and can be used to discard hidden files and/or directories. See this example for filter_tree
in the API docs, which illustrates just that. I expect this to be a fairly common pattern, so I may introduce functions on Walk
to make this kind of filtering easier to achieve. Note that this only applies to semantic matching (i.e., Glob::walk
and friends) and not logical matching (i.e., Pattern::is_match
).
Toggling case sensitivity via an API would prevent glob expressions from matching sub-text using different casing requirements. Instead, Wax uses flags for this. Every expression chooses how and where casing is handled. In the simplest instance, expressions simply begin with a flag, such as in (?i)**/insensitive
.
Regarding literal separators, glob expressions are designed with consistent behavior in mind, especially for individual patterns. For this reason, the matching behavior of patterns is deliberately not configurable. Instead, glob expressions can match across component boundaries via tree wildcards **
and/or repetitions <...>
.
Please let me know if there's a remaining feature that you think Wax should support or that you're unsure how to achieve using the current API.
Thanks for your detailed instruction, it seems I can work around this :-)
Close the issue for now:)
It would be nice to support some glob options, like matching hidden directory or not.
In the
nu-glob
crate(which is a fork ofglob
crate with some addition, it supports something like this: https://github.com/nushell/nushell/blob/main/crates/nu-glob/src/lib.rs#L870-L892