or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

console-integration.mddocumentation-inspection.mdindex.mdinteractive-commands.mdscript-engine.md

interactive-commands.mddocs/

0

# Interactive Commands

1

2

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.

3

4

## Capabilities

5

6

### File System Commands

7

8

Basic file system operations for navigating and manipulating files within the shell environment.

9

10

```bash { .api }

11

# Clear terminal screen

12

/clear

13

14

# Print working directory

15

/pwd

16

17

# Change directory

18

/cd [directory]

19

20

# List directory contents

21

/ls [options] [files]

22

23

# Display file contents

24

/cat [files]

25

26

# Search files for patterns

27

/grep [pattern] [files]

28

29

# Display end of files

30

/tail [files]

31

32

# Display beginning of files

33

/head [files]

34

35

# Word/line/character count

36

/wc [files]

37

38

# Sort file contents

39

/sort [files]

40

41

# Display current date/time

42

/date

43

44

# Echo text to output

45

/echo [text]

46

47

# Execute shell command

48

/! [command]

49

```

50

51

**Usage Examples:**

52

53

```bash

54

groovy> /pwd

55

/home/user/project

56

57

groovy> /ls *.groovy

58

Calculator.groovy

59

Utils.groovy

60

61

groovy> /cat Calculator.groovy

62

class Calculator {

63

static def add(a, b) { a + b }

64

}

65

66

groovy> /grep "def" *.groovy

67

Calculator.groovy:2: static def add(a, b) { a + b }

68

69

groovy> /echo "Hello World"

70

Hello World

71

72

groovy> /! ls -la

73

total 16

74

drwxr-xr-x 4 user user 4096 Sep 10 12:00 .

75

```

76

77

### State Management Commands

78

79

Commands for managing variables, imports, methods, types, and overall engine state.

80

81

```bash { .api }

82

# Show or delete variables

83

/vars [name]

84

85

# Show or delete import statements

86

/imports [name]

87

88

# Show or delete type definitions

89

/types [name]

90

91

# Show or delete method definitions

92

/methods [name]

93

94

# Clear all state (variables, imports, methods, types)

95

/reset

96

```

97

98

**Usage Examples:**

99

100

```bash

101

groovy> def x = 42

102

groovy> import java.util.Date

103

groovy> /vars

104

x = 42

105

106

groovy> /imports

107

import java.util.Date

108

109

groovy> /vars x

110

Removed variable: x

111

112

groovy> /reset

113

All state cleared (variables, imports, methods, types)

114

115

groovy> /vars

116

No variables defined

117

```

118

119

### File Operations Commands

120

121

Load and save functionality for script files and engine state persistence.

122

123

```bash { .api }

124

# Load script file or saved state

125

/load [options] [file]

126

# Options:

127

# -m, --merge Merge with current state instead of replacing

128

129

# Save current state or buffer to file

130

/save [options] [file]

131

# Options:

132

# -o, --overwrite Overwrite existing file

133

134

# Parse structured data files

135

/slurp [options] file|variable

136

# Supported formats: JSON, YAML, XML, TOML, CSV

137

```

138

139

**Usage Examples:**

140

141

```bash

142

groovy> /save mystate.groovy

143

State saved to mystate.groovy

144

145

groovy> /load mystate.groovy

146

State loaded from mystate.groovy

147

148

groovy> /load --merge additional.groovy

149

Merged state from additional.groovy

150

151

groovy> /slurp data.json

152

Loaded JSON data into _ variable

153

154

groovy> /slurp config.yaml

155

Loaded YAML data into _ variable

156

```

157

158

### Development Commands

159

160

Advanced development tools for object inspection, documentation access, and dependency management.

161

162

```bash { .api }

163

# Inspect object properties and methods

164

/inspect [options] object

165

# Options:

166

# -i, --info Show object information

167

# -m, --methods Show object methods

168

# -n, --metaMethods Show meta-methods

169

# -g, --gui Open in GUI object browser

170

171

# Open documentation for object in browser

172

/doc object

173

174

# Launch Groovy console GUI (if available)

175

/console

176

177

# Add Maven dependencies to classpath

178

/grab group:artifact:version

179

180

# Manage classloader and view loaded classes

181

/classloader [options]

182

# Options:

183

# -v, --view View classloader information

184

# -a, --add Add JAR file to classpath

185

# -d, --delete Remove from classpath

186

```

187

188

**Usage Examples:**

189

190

```bash

191

groovy> def list = [1, 2, 3]

192

groovy> /inspect list

193

Object: [1, 2, 3]

194

Class: java.util.ArrayList

195

Size: 3

196

197

groovy> /inspect -m list

198

Methods for java.util.ArrayList:

199

add(Object)

200

get(int)

201

size()

202

...

203

204

groovy> /doc String

205

Opening documentation for java.lang.String...

206

207

groovy> /grab org.apache.commons:commons-lang3:3.12.0

208

Added dependency: commons-lang3-3.12.0.jar

209

210

groovy> /classloader -v

211

Classloader Information:

212

URLs: [file:/path/to/commons-lang3-3.12.0.jar, ...]

213

Parent: sun.misc.Launcher$AppClassLoader

214

215

groovy> /console

216

Launching Groovy Console...

217

```

218

219

## Command Features

220

221

### Auto-completion

222

223

All commands support tab completion for:

224

- Command names and options

225

- File paths and directory names

226

- Maven coordinates for `/grab`

227

- Variable names for inspection

228

- Available methods and properties

229

230

### Help System

231

232

Every command provides built-in help:

233

234

```bash

235

groovy> /help

236

Available commands:

237

/clear - Clear terminal screen

238

/pwd - Print working directory

239

/cd - Change directory

240

...

241

242

groovy> /inspect --help

243

/inspect - Display/browse object info on terminal/object browser

244

Usage: /inspect [OPTIONS] OBJECT

245

-i, --info Show object information

246

-m, --methods Show object methods

247

-n, --metaMethods Show meta-methods

248

-g, --gui Open in GUI object browser

249

```

250

251

### Error Handling

252

253

Commands provide clear error messages and usage hints:

254

255

```bash

256

groovy> /load nonexistent.groovy

257

Error: File not found: nonexistent.groovy

258

259

groovy> /grab invalid:coordinates

260

Error: Invalid Maven coordinates format

261

Usage: /grab group:artifact:version

262

263

groovy> /inspect

264

Usage: /inspect [OPTIONS] OBJECT

265

Error: Object parameter required

266

```

267

268

### Command Aliases

269

270

Common command aliases for convenience:

271

272

```bash

273

/x -> /exit

274

/q -> /exit

275

/h -> /help

276

```

277

278

### Command History

279

280

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

281

- Up/Down arrow keys

282

- Ctrl+R for reverse search

283

- History persisted across sessions

284

285

### Pipe Operations

286

287

Support for custom pipe operators in command execution:

288

289

```bash

290

# Conditional execution

291

command1 |&& command2 # Execute command2 only if command1 succeeds

292

293

# Alternative execution

294

command1 ||| command2 # Execute command2 only if command1 fails

295

296

# Output redirection

297

/ls |> output.txt # Redirect output to file

298

/vars |>> variables.log # Append output to file

299

```