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
The following commit(s) were added to refs/heads/master by this push:
new 0edc8b78f8 GROOVY-8162: Update Groovysh to JLine3 (allow state to be
saved)
0edc8b78f8 is described below
commit 0edc8b78f8c98f295b38e0fe727f9d884a17f717
Author: Paul King <[email protected]>
AuthorDate: Mon Jul 21 18:06:52 2025 +1000
GROOVY-8162: Update Groovysh to JLine3 (allow state to be saved)
---
.../groovy/groovysh/jline/GroovyCommands.groovy | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyCommands.groovy
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyCommands.groovy
index 65398b8bac..fc7e938bc4 100644
---
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyCommands.groovy
+++
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyCommands.groovy
@@ -60,8 +60,8 @@ class GroovyCommands extends JlineCommandRegistry implements
CommandRegistry {
'/imports' : new Tuple4<>(this::importsCommand,
this::importsCompleter, this::nameDeleteCmdDesc, ['show/delete import
statements']),
'/vars' : new Tuple4<>(this::varsCommand, this::varsCompleter,
this::nameDeleteCmdDesc, ['show/delete variable declarations']),
'/reset' : new Tuple4<>(this::reset, this::defCompleter,
this::defCmdDesc, ['clear the buffer']),
- '/load' : new Tuple4<>(this::load, this::loadCompleter,
this::loadCmdDesc, ['load a file into the buffer']),
- '/save' : new Tuple4<>(this::save, this::saveCompleter,
this::defCmdDesc, ['save the buffer to a file']),
+ '/load' : new Tuple4<>(this::load, this::loadCompleter,
this::loadCmdDesc, ['load state/a file into the buffer']),
+ '/save' : new Tuple4<>(this::save, this::saveCompleter,
this::saveCmdDesc, ['save state/the buffer to a file']),
'/types' : new Tuple4<>(this::typesCommand,
this::typesCompleter, this::nameDeleteCmdDesc, ['show/delete types']),
'/methods' : new Tuple4<>(this::methodsCommand,
this::methodsCompleter, this::nameDeleteCmdDesc, ['show/delete methods'])
]
@@ -471,7 +471,7 @@ class GroovyCommands extends JlineCommandRegistry
implements CommandRegistry {
private CmdDesc grabCmdDesc(String name) {
new CmdDesc([
- new AttributedString("$name [OPTIONS]
<group>:<artifact>:<version>"),
+ new AttributedString("$name [options]
<group>:<artifact>:<version>"),
new AttributedString("$name --list")
], [], [
'-? --help' : doDescription('Displays command help'),
@@ -499,13 +499,24 @@ class GroovyCommands extends JlineCommandRegistry
implements CommandRegistry {
private CmdDesc loadCmdDesc(String name) {
new CmdDesc([
- new AttributedString("$name filename"),
+ new AttributedString("$name"),
+ new AttributedString("$name [options] filename")
], [], [
'-? --help' : doDescription('Displays command help'),
'-m --merge' : doDescription('Merge into existing buffer')
])
}
+ private CmdDesc saveCmdDesc(String name) {
+ new CmdDesc([
+ new AttributedString("$name"),
+ new AttributedString("$name [options] filename")
+ ], [], [
+ '-? --help' : doDescription('Displays command help'),
+ '-o --overwrite' : doDescription('Overwrite existing file')
+ ])
+ }
+
private CmdDesc inspectCmdDesc(String name) {
def optDescs = [
'-? --help' : doDescription('Displays command help'),