Skip to end of metadata
Go to start of metadata

This page is dedicated to the discussion of what the Groovy Shell (aka. groovysh) and Groovy Console (aka. groovyConsole) should be able to do in the future. So please go on and add suggestions.

Wishlist for the command-line Groovy Shell (aka. groovysh)

  • keep imports (DONE see import and show imports commands)
  • remove the requirement for the "go" command (DONE)
    • proposal: read lines until one is entered WITHOUT a trailing semicolon or as long as there are open parantheses; change prompt for continuation lines
  • the value of last expression evaluated is made available in a variable. The name of the variable is short , e.g. "res". It is also automatically printed to the console (including type?). (DONE The last result is saved as the {_} variable)
    • alternate name: "_" or "_r"

from Dierk

  • code completion for known methods, DGM, and symbols used so far
  • dump transcript to file (DONE see record).
  • nice to have: dump classes and methods that were previously defined (DONE See show classes and show variables, methods are wrapped in a closure and bound to variables)
  • nice to have: run code in new jdb console

from Guillaume

  • all the above, and...
  • possibility to discard imports (since we can keep imports, let's flush them too) (DONE See purge imports).
  • Crazy idea: I'm wondering whether we could leverage ANSI colours in the shell so that we can have some text in colours (perhaps even syntax highlighting???) (DONE sans syntax highlighting right now)

from Jürgen:

  •  learn from Python and especially IPython (sys.displayhook etc.) (DONE There is a errorHook and resultHook now).
  • (GNU) readline support (DONE current trunk uses jline for rich buffer editing and history).

additionally: enhance ObjectBrowser to execute selected methods and change the "object under inspection" to the result of that method call. Keep an expression of how to get to that object (e.g. GPath). Let ObjectBrowser return this expression and make groovysh and groovyConsole arware of it such that groovysh user can use the inspect command to interactively construct such expressions.

Wishlist for the Swing Console (aka. groovyConsole)

  • basic syntax highlighting in source code (DONE in 1.5*)*
  • line numbers (be able to turn on / off)
  • be able to specify some .jar files that will be included into the classpath (DONE in 1.6)
  • enable standard-de-facto ctrl+z for undo and ctrl+y for redo
  • tabs
  • code formatting

Debug features:

  • step-by-step execution of statements
  • improve variables insight for clarity


  • No labels


  1. I think the ideal scripting console is IPython (interactive Python), I think we should imitate it as much as possible.

  2. It would be so great if the Groovy Console could run 1 single session, just like the beanshell console. It really works as an interpreter. You can keep all your variables during the same session and don't have to pres "run" to re-execute the whole script from scratch each time.

  3. I think it would be best if the shell could take a script name as an argument (i.e., "grails shell <scriptname>") and have the shell execute the script and exit, dumping output to stdout.  This would be an easy way to perform administrative tasks on the datastore within the context of the application.  It would also allow these tasks to be run in an unattended manner.

  4. I cannot find where to place bug report for GroovyConsole. This is minor, but I was going through Barclay and Savage book, and one of the questions (Chapter 2, 3b) asked if a$ was a valid Groovy identifier. I thought not. but GroovyConsole lets it in.
    Here try it:

    def a$ = 7
    println (a$ + 4)

    Sorry. I looked around for maybe 30 minutes and could not find where to register GroovyConsole bugs. Maybe that is because it is almost perfect?

  5. Hi Bradley, you enter bugs for GroovyConsole in the standard Groovy Jira:
    Just select the component type to be Groovy Console.
    What is the bug by the way?