Interactive command-line shell (REPL) for Apache Groovy with scripting engine and rich command system
—
Built-in shell commands for file operations, object inspection, documentation lookup, dependency management, and state control. These commands provide a rich interactive development environment within the Groovy shell REPL.
Basic file system operations for navigating and manipulating files within the shell environment.
# Clear terminal screen
/clear
# Print working directory
/pwd
# Change directory
/cd [directory]
# List directory contents
/ls [options] [files]
# Display file contents
/cat [files]
# Search files for patterns
/grep [pattern] [files]
# Display end of files
/tail [files]
# Display beginning of files
/head [files]
# Word/line/character count
/wc [files]
# Sort file contents
/sort [files]
# Display current date/time
/date
# Echo text to output
/echo [text]
# Execute shell command
/! [command]Usage Examples:
groovy> /pwd
/home/user/project
groovy> /ls *.groovy
Calculator.groovy
Utils.groovy
groovy> /cat Calculator.groovy
class Calculator {
static def add(a, b) { a + b }
}
groovy> /grep "def" *.groovy
Calculator.groovy:2: static def add(a, b) { a + b }
groovy> /echo "Hello World"
Hello World
groovy> /! ls -la
total 16
drwxr-xr-x 4 user user 4096 Sep 10 12:00 .Commands for managing variables, imports, methods, types, and overall engine state.
# Show or delete variables
/vars [name]
# Show or delete import statements
/imports [name]
# Show or delete type definitions
/types [name]
# Show or delete method definitions
/methods [name]
# Clear all state (variables, imports, methods, types)
/resetUsage Examples:
groovy> def x = 42
groovy> import java.util.Date
groovy> /vars
x = 42
groovy> /imports
import java.util.Date
groovy> /vars x
Removed variable: x
groovy> /reset
All state cleared (variables, imports, methods, types)
groovy> /vars
No variables definedLoad and save functionality for script files and engine state persistence.
# Load script file or saved state
/load [options] [file]
# Options:
# -m, --merge Merge with current state instead of replacing
# Save current state or buffer to file
/save [options] [file]
# Options:
# -o, --overwrite Overwrite existing file
# Parse structured data files
/slurp [options] file|variable
# Supported formats: JSON, YAML, XML, TOML, CSVUsage Examples:
groovy> /save mystate.groovy
State saved to mystate.groovy
groovy> /load mystate.groovy
State loaded from mystate.groovy
groovy> /load --merge additional.groovy
Merged state from additional.groovy
groovy> /slurp data.json
Loaded JSON data into _ variable
groovy> /slurp config.yaml
Loaded YAML data into _ variableAdvanced development tools for object inspection, documentation access, and dependency management.
# Inspect object properties and methods
/inspect [options] object
# Options:
# -i, --info Show object information
# -m, --methods Show object methods
# -n, --metaMethods Show meta-methods
# -g, --gui Open in GUI object browser
# Open documentation for object in browser
/doc object
# Launch Groovy console GUI (if available)
/console
# Add Maven dependencies to classpath
/grab group:artifact:version
# Manage classloader and view loaded classes
/classloader [options]
# Options:
# -v, --view View classloader information
# -a, --add Add JAR file to classpath
# -d, --delete Remove from classpathUsage Examples:
groovy> def list = [1, 2, 3]
groovy> /inspect list
Object: [1, 2, 3]
Class: java.util.ArrayList
Size: 3
groovy> /inspect -m list
Methods for java.util.ArrayList:
add(Object)
get(int)
size()
...
groovy> /doc String
Opening documentation for java.lang.String...
groovy> /grab org.apache.commons:commons-lang3:3.12.0
Added dependency: commons-lang3-3.12.0.jar
groovy> /classloader -v
Classloader Information:
URLs: [file:/path/to/commons-lang3-3.12.0.jar, ...]
Parent: sun.misc.Launcher$AppClassLoader
groovy> /console
Launching Groovy Console...All commands support tab completion for:
/grabEvery command provides built-in help:
groovy> /help
Available commands:
/clear - Clear terminal screen
/pwd - Print working directory
/cd - Change directory
...
groovy> /inspect --help
/inspect - Display/browse object info on terminal/object browser
Usage: /inspect [OPTIONS] OBJECT
-i, --info Show object information
-m, --methods Show object methods
-n, --metaMethods Show meta-methods
-g, --gui Open in GUI object browserCommands provide clear error messages and usage hints:
groovy> /load nonexistent.groovy
Error: File not found: nonexistent.groovy
groovy> /grab invalid:coordinates
Error: Invalid Maven coordinates format
Usage: /grab group:artifact:version
groovy> /inspect
Usage: /inspect [OPTIONS] OBJECT
Error: Object parameter requiredCommon command aliases for convenience:
/x -> /exit
/q -> /exit
/h -> /helpAll commands are saved in shell history and can be recalled using:
Support for custom pipe operators in command execution:
# Conditional execution
command1 |&& command2 # Execute command2 only if command1 succeeds
# Alternative execution
command1 ||| command2 # Execute command2 only if command1 fails
# Output redirection
/ls |> output.txt # Redirect output to file
/vars |>> variables.log # Append output to fileInstall with Tessl CLI
npx tessl i tessl/maven-org-apache-groovy--groovy-groovysh