Open Franciman opened 5 years ago
In general in shells brace expansion isn't considered part of path globbing, but it's a more generic expansion syntax. For instance echo x/[ab]/y
will only match the paths x/a/y
and x/b/y
if they exist, whereas echo x/{a,b}/y
should always echo x/a/y x/b/y
. Thus it's more akin to supporting variable expansion like $foo
or arithmetic like $((1 + 2))
, which is also why I left it out originally.
Parsing out the brace expansion separately and handing each resulting word over to System.FilePath.Glob.glob
would match what real shells do, semantically speaking. I don't think this really belongs in this library, though I can see its value as a convenience.
I don't know what Cabal would do in the x/{a,b}/y
case but it probably wants all specified file paths to exist anyway and so doesn't have to bother with this difference. Or then it understands these patterns in a different way to the common shells.
All in all there'd be a bit of research involved to see what other globbing libraries do with brace expansion to scope out reasonable alternatives, and then some possible feature work as a result.
Unfortunately, my usual disclaimer applies: I simply don't have the free time to spare for this kind of larger task any more. PRs are welcome, although in this case I'd first like to see some more analysis and that's probably best handled within this issue.
https://cabal.readthedocs.io/en/latest/nix-local-build.html?highlight=packages#cfg-field-packages Here is some more info about how cabal understands globs.
Anyways, I understand, thank you. I will try to separately unroll braces
Hi, is it possible to add support for globs using this syntax?
This would match both
/path/to/a/c
and/path/to/b/c
.In
cabal.project
you can specify globs using this syntax ( the grammar is specified here).It would be really useful if one could use
Glob
to parse the whole syntax supported incabal.project
files, and as far as I understand, this is the only missing piece.