This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 720108cbdcf30efe27c740b461031a235047f2f2 Author: Paul King <[email protected]> AuthorDate: Sun Aug 3 17:14:08 2025 +1000 GROOVY-8162: Update Groovysh to JLine3 (document /classloader) --- .../groovy-groovysh/src/spec/doc/groovysh.adoc | 127 +++++++++++---------- 1 file changed, 68 insertions(+), 59 deletions(-) diff --git a/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc b/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc index 20b9df6f93..bd2634a5d2 100644 --- a/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc +++ b/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc @@ -252,13 +252,22 @@ image:assets/img/repl_alias2.png[More /alias examples, width=60%] Aliases are persisted in a `.groovysh/aliases.json` file in the user home directory. +[[GroovyShell-classloader]] +==== `/classloader` + +Display and manage the Groovy classloader data. + +Let's `/grab` a dependency, define a class using it, and then use the `/classloader` command to see the classloader data: + +image:assets/img/repl_classloader.png[Classloader, width=80%] + [[GroovyShell-clear]] -===== `/clear` +==== `/clear` Clears the screen. [[GroovyShell-del]] -===== `/del` +==== `/del` Deletes objects from the shell. @@ -281,8 +290,42 @@ Exit the shell. This is the *only* way to exit the shell. Well, you can still `CTRL-Z` on unix platforms, but things like `CTRL_C` are trapped. (See JLine3 documentation for more details.) +[[GroovyShell-grab]] +==== `/grab` + +Grab a dependency (Maven, Ivy, etc.) from Internet sources or cache, +and add it to the Groovy Shell environment. + +[source,jshell] +---- +groovy> /grab org.apache.commons:commons-collections4:4.5.0 +groovy> import org.apache.commons.collections4.bidimap.TreeBidiMap +groovy> TreeBidiMap t = [apple: 'red'] +{apple=red} +groovy> t.inverseBidiMap() +{red=apple} +---- + +Completion is available. Currently, completion options are populated +by known artifacts in the local Maven (~/.m2) and Grape (~/.groovy/grapes) repositories. In the future, completion from a remote repositories may be supported. + +[source,jshell] +---- +groovy> /grab org.apache.commons:commons-<TAB> +org.apache.commons:commons-collections4: org.apache.commons:commons-exec: +org.apache.commons:commons-compress: org.apache.commons:commons-imaging: +org.apache.commons:commons-configuration2: org.apache.commons:commons-lang3: +org.apache.commons:commons-crypto: org.apache.commons:commons-math3: +org.apache.commons:commons-csv: org.apache.commons:commons-parent: +org.apache.commons:commons-dbcp2: org.apache.commons:commons-pool2: +org.apache.commons:commons-digester3: org.apache.commons:commons-text: +org.apache.commons:commons-email: +---- + +This command can be given at any time to add new dependencies. + [[GroovyShell-import]] -===== `import` +==== `import` Add a custom import which will be included for all shell evaluations. @@ -311,7 +354,7 @@ Once an import statement has been executed, relevant classes will become availab image:assets/img/repl_import.png[Import, width=80%] [[GroovyShell-imports]] -===== `/imports` +==== `/imports` You can use this to list and delete existing imports. @@ -321,42 +364,8 @@ groovy> /imports import java.util.concurrent.BlockingQueue -------------- -[[GroovyShell-grab]] -===== `/grab` - -Grab a dependency (Maven, Ivy, etc.) from Internet sources or cache, -and add it to the Groovy Shell environment. - -[source,jshell] ----- -groovy> /grab org.apache.commons:commons-collections4:4.5.0 -groovy> import org.apache.commons.collections4.bidimap.TreeBidiMap -groovy> TreeBidiMap t = [apple: 'red'] -{apple=red} -groovy> t.inverseBidiMap() -{red=apple} ----- - -Completion is available. Currently, completion options are populated -by known artifacts in the local Maven (~/.m2) and Grape (~/.groovy/grapes) repositories. In the future, completion from a remote repositories may be supported. - -[source,jshell] ----- -groovy> /grab org.apache.commons:commons-<TAB> -org.apache.commons:commons-collections4: org.apache.commons:commons-exec: -org.apache.commons:commons-compress: org.apache.commons:commons-imaging: -org.apache.commons:commons-configuration2: org.apache.commons:commons-lang3: -org.apache.commons:commons-crypto: org.apache.commons:commons-math3: -org.apache.commons:commons-csv: org.apache.commons:commons-parent: -org.apache.commons:commons-dbcp2: org.apache.commons:commons-pool2: -org.apache.commons:commons-digester3: org.apache.commons:commons-text: -org.apache.commons:commons-email: ----- - -This command can be given at any time to add new dependencies. - [[GroovyShell-less]] -===== `/less` +==== `/less` Display the contents of a file (usually a page at a time). Formatting of common file types is supported. @@ -364,17 +373,12 @@ Formatting of common file types is supported. image:assets/img/repl_less.png[Usage of the /less command, width=85%] [[GroovyShell-reset]] -===== `/reset` +==== `/reset` Clears the current buffer and shared variables. -[[GroovyShell-show]] -===== `/show` - -Show the shared variables (the binding). - [[GroovyShell-prnt]] -===== `/prnt` +==== `/prnt` The `/prnt` command outputs its argument to the console. Both variable expansion and formatting are supported. @@ -385,37 +389,42 @@ See also the `/echo` command, which is similar but takes multiple arguments. It also supports variable expansion but doesn't support formatting. [[GroovyShell-inspect]] -===== `/inspect` +==== `/inspect` Opens the GUI object browser to inspect a variable or the result of the last evaluation. -[[GroovyShell-nano]] -===== `/nano` - -Edit the current buffer in an external editor. - -Currently only works on UNIX systems which have the `EDITOR` environment -variable set, or have configured the `editor` preference. - [[GroovyShell-load]] -===== `/load` +==== `/load` Load a file into the buffer. If no filename is given as an argument, the current shared variables are loaded from the `.groovy/groovysh.ser` file in the user home directory. +[[GroovyShell-nano]] +==== `/nano` + +Edit the current buffer in an external editor. + +Currently only works on UNIX systems which have the `EDITOR` environment +variable set, or have configured the `editor` preference. + [[GroovyShell-save]] -===== `/save` +==== `/save` Saves the buffer’s contents to a file. If no filename is given as an argument, the current shared variables are saved into the `.groovy/groovysh.ser` file in the user home directory. +[[GroovyShell-show]] +==== `/show` + +Show the shared variables (the binding). + [[GroovyShell-history]] -===== `/history` +==== `/history` Display, manage and recall edit-line history. @@ -432,7 +441,7 @@ Display, manage and recall edit-line history. `history clear` [[GroovyShell-doc]] -===== `/doc` +==== `/doc` Opens a browser with documentation for the provided class.
