Glob-mapper functions added like FileTree
Wanted to get people's thoughts on glob-mapping of files using the File-Tree-Walker style interface. (This is an idea I got from SBT)
Imagine the following code:
for {
file <- pwd / ** / "*.log" //The spaces are necessary so we don't make a comment!
lines <- file.readLines
if line startsWith "[ERROR]"
} yield line
for pulling out all lines from all log files under the current working directory or any sub-directory.
Another example:
for {
file <- pwd / * ".log"
lines <- file.readLines
if line startsWith "[ERROR]"
} yield line
This would do something similar to the above but only for one directory.
I'm not exactly happy with the operators used, but I do like the idea. Any thoughts?
- Josh