Not a bad idea. The .g would have to be after the directory in which to search. Paulp also suggested just using the existing regularExpression.
So....
for {
file <- pwd / "**/*.log".r
...
or
for {
file <- pwd / "**/*.log".g
...
I'm thinking .g might actually be required so we can specially handle the ** as "in any subdirectory". If we used pure regular expressions, it would confuse those who expected glob-mapping. Perhaps a combined approach that would allow either?
- Josh
On Sun, Jun 21, 2009 at 3:10 PM, Alex Boisvert
<bois...@intalio.com> wrote:
Another idea would be to define a pimp conversion "globExpression".g analogous to the standard "regularExpression".r
for {
file <- (pwd + "/**/*.log").g
lines <- file.readLines
if line startsWith "[ERROR]"
} yield line
The ** and * globs are easy to masquerade into the syntax but what about things like .{c, cpp, java} ?
for {
file <- (pwd + "/**/*.{java,scala}").g
lines <- file.readLines
if line startsWith "[ERROR]"
} yield line