Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2014 14:02
Show Gist options
  • Save anonymous/9134774 to your computer and use it in GitHub Desktop.
Save anonymous/9134774 to your computer and use it in GitHub Desktop.
A set of shell JVM commands for CRaSH http://try.crashub.org
// Class based commands using annotations
class dir {
@Usage("show the current directory")
@Command
void main(@Usage("the dir to list") @Argument String path) {
File dir = path != null ? new File(path) : new File(".");
def files = dir.listFiles();
files.each { file ->
context.provide(NAME:file.name,LENGTH:file.length(),DATE:new Date(file.lastModified()))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment