Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Improving CLI mode for Groovy
class CLICategory {
static Iterator getLines(String f) { new File(f).iterator() }
static int getLength(String s) { s.length() }
static def max(Iterator c,String property) { c.max { it."$property" } }
}
def propertyMissing(String p) { "$p" }
use (CLICategory) {
'quotes.txt'.lines.max length
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.