The Groovy Shell, aka.
groovysh is a command-line application which allows easy access to evaluate Groovy expressions, define classes and run simple experiments.
- Command-line Options and Arguments
- Evaluating Expressions
- User Profile Scripts and State
- Screen Shots
- No need for
gocommand to execute buffer.
- Rich cross-platform edit-line editing, history and completion thanks to JLine.
- ANSI colors (prompt, exception traces, etc).
- Simple, yet robust, command system with online help, user alias support and more.
- User profile support
Command-line Options and Arguments
The shell supports several options to control verbosity, ANSI coloring and other features.
In addition to options, commands or expressions can be given on the command-line which will invoke the shell in non-interactive mode. The commands or expressions will be evaluated and the shell will exit.
The shell has a number of different commands, which provide rich access to the shell's environment.
Commands all have a name and a shortcut (which is something like
\h). Commands may also have some predefined system aliases. Users may also create their own aliases.
Display the list of commands (and aliases) or the help text for specific command.
The Command List
Help for a Command
While in the interactive shell, you can ask for help for any command to get more details about its syntax or function. Here is an example of what happens when you ask for help for the
Some of aspects of
groovysh behaviors can be customized by setting preferences. Preferences are set using the
set command or the
Set the shell's verbosity level. Expected to be one of:
If this preference is set to an invalid value, then the previous setting will be used, or if there is none, then the preference is removed and the default is used.
Show the last result after an execution.
Sanitize (trim-down/filter) stack traces.
Setting a Preference
To list the current set preferences (and their values):
Clearing Preferences (ie. Resetting to Defaults)
User Profile Scripts and State
These shots have been taken over the development of the new shell, so some of the content might look slightly different. Also, note the yellow colors here are the shell's bold color, so the colors might look different depending on how the enclosing shell has its colors setup.