[globset] support more options on GlobBuilder?
Describe your feature request
Refer to GlobBuilder, it supports case_insensitive, literal_separator and backslash_escape.
I wonder if it can support more options includes:
/// Whether or not paths that contain components that start with a `.`
/// will require that `.` appears literally in the pattern; `*`, `?`, `**`,
/// or `[...]` will not match. This is useful because such files are
/// conventionally considered hidden on Unix systems and it might be
/// desirable to skip them when listing files.
require_literal_leading_dot: bool
/// if given pattern contains `**`, this flag check if `**` matches hidden directory.
/// For example: if true, `**` will match `.abcdef/ghi`.
recursive_match_hidden_dir: bool
Which mainly works for hidden directory or hidden file
I'm sure it can be supported. I didn't originally because I wasn't convinced of their utility. And more to the point, it somewhat encourages writing non-portable code. Namely, while a leading dot is a convention used on Unix to indicate a hidden file or directory, this convention is less used on Windows. On Windows, whether something is hidden or not is actually a first class property of the file's metadata.
On the other hand, globs tend to be written by end users, and in that context, portability isn't always needed.
In any case, it would be good to explain why you want these things. What would you use them for if they existed?
Background: I'm trying to help to make ls command better in nushell, it uses glob crate.
But it seems that glob doesn't support non-UTF8 path, and it would be tricky to make glob support it. I'm searching for other replacement, one choice is the globset crate
If we use ls -a **, we would expect recursive_match_hidden_dir to be true and return hidden directories. Simply use ls ** will not return hidden directories (only for unix)
If you can find a way to add the things you need along with tests without any major reworking of the code, I'd accept a patch.