Skip to content

Instantly share code, notes, and snippets.

@fmamud
Last active April 22, 2016 15:19
Show Gist options
  • Save fmamud/155c9b4e5f851b05c89d81f2ba31abb9 to your computer and use it in GitHub Desktop.
Save fmamud/155c9b4e5f851b05c89d81f2ba31abb9 to your computer and use it in GitHub Desktop.
Add unix ls command to groovysh
// open groovysh
// execute :rc ls
import org.codehaus.groovy.tools.shell.CommandSupport
import org.codehaus.groovy.tools.shell.Groovysh
class Ls extends CommandSupport {
protected Ls(final Groovysh shell) {
super(shell, ':ls', ':dir')
}
public Object execute(List args) {
println "ls -l".execute().text
}
}
command.description=List all files on current directory
command.usage=
command.help=List all files on current directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment