-
Notifications
You must be signed in to change notification settings - Fork 724
Bash (globstar) style globbing #1975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
It's just occurred to me that it might be easier to have |
Ensure that canonicalise operates on nested Globs within choices rather than just the top level Glob
|
Thoughts so far:
Any feedback is very welcome. |
|
Is it ok to follow symlinks when expanding a pattern? |
|
Also presumably this should apply to all fields of type filename list - that is:
|
|
It might be worth looking at existing implementations of glob patterns, Haskell or otherwise, for inspiration. One example: https://hackage.haskell.org/package/Glob |
|
oh yeah, thanks, I forgot about that library. Looking at the documentation it seems the people who wrote that seem to know what they're doing, certainly more than I do. Is there a policy on what packages Cabal is allowed to depend on? I guess you want to keep that list as small as possible? |
|
Right now we can only depend on packages that ship with GHC, as Cabal ships with GHC. We're trying to fix that issue in the future (by not having GHC depend on Cabal), but in the meantime perhaps we could just include the minimal amount of code to support globbing in Cabal itself. |
To clarify: this refers only to the Cabal library itself, not to |
|
Ok, great - thanks - I'll continue working on this when I get a moment. |
|
OK, I'm going to close this PR for now, please reopen when you have more! |
|
Looking forward to this. |
|
I found some time! I have more code, but I'm not able to reopen this. |
|
Also it seems like https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Utils.hs#L754 |
No, it looks like it searches the directory |
|
What is the status of this? |
|
Dead by bikeshedding in #2522 (comment). |
Implement bash style filename globbing for data-files (well, bash after doing
shopt -s globstar). Subsumes #713 #784 #1343 #1344 #1973The plan:
*can expand to a part of any file or directory but not descend into subdirectories**is the same, except that it can match any number of levels of directories (including 0).{a,b,c}can expand intoa,b, orc, wherea,b, andcare globs themselves. So{foo,*bar}expands to "foo" or "abar" or "bbar"...foo/**/*is allowed, and so isfoo/**/*.hs, andfoo/**/Test*.hs, andfoo/**/*{Test,Spec}*.hs.{,},*,\in it, a backslash\is required to match it literally. Eg the patterna\\bmatchesa\b, and the pattern\eis an error (because no such escape sequence exists).Here's what I've done so far. It typechecks, but if I try to parse anything, it hangs. Any ideas?