CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-apache-groovy--groovy-groovysh

Interactive command-line shell (REPL) for Apache Groovy with scripting engine and rich command system

Pending
Overview
Eval results
Files

interactive-commands.mddocs/

Interactive Commands

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.

Capabilities

File System Commands

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 .

State Management Commands

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)
/reset

Usage 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 defined

File Operations Commands

Load 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, CSV

Usage 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 _ variable

Development Commands

Advanced 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 classpath

Usage 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...

Command Features

Auto-completion

All commands support tab completion for:

  • Command names and options
  • File paths and directory names
  • Maven coordinates for /grab
  • Variable names for inspection
  • Available methods and properties

Help System

Every 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 browser

Error Handling

Commands 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 required

Command Aliases

Common command aliases for convenience:

/x    -> /exit
/q    -> /exit  
/h    -> /help

Command History

All commands are saved in shell history and can be recalled using:

  • Up/Down arrow keys
  • Ctrl+R for reverse search
  • History persisted across sessions

Pipe Operations

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 file

Install with Tessl CLI

npx tessl i tessl/maven-org-apache-groovy--groovy-groovysh

docs

console-integration.md

documentation-inspection.md

index.md

interactive-commands.md

script-engine.md

tile.json