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 b190006b2f27f872723aff67b237326ad0d455b2 Author: Paul King <[email protected]> AuthorDate: Thu Aug 7 21:41:58 2025 +1000 GROOVY-11730: Bump JLine to 3.30.5 --- .../groovy/org/apache/groovy/groovysh/Main.groovy | 8 ---- .../groovysh/jline/GroovyConsoleEngine.groovy | 48 ---------------------- versions.properties | 2 +- 3 files changed, 1 insertion(+), 57 deletions(-) diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main.groovy b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main.groovy index c81ed32ba5..66ba3dcfa3 100644 --- a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main.groovy +++ b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main.groovy @@ -264,19 +264,11 @@ class Main { setCommandRegistries(extra, consoleEngine, builtins, groovy) addCompleter(scriptEngine.scriptCompleter) setScriptDescription(scriptEngine::scriptDescription) - // sys registry doesn't support rename/alias, so for now invoke as user alias -/* renameLocal 'exit', '/exit' renameLocal 'help', '/help' invoke '/alias', '/x', '/exit' invoke '/alias', '/q', '/exit' invoke '/alias', '/h', '/help' -*/ - invoke '/alias', '/exit', 'exit' - invoke '/alias', '/help', 'help' - invoke '/alias', '/x', 'exit' - invoke '/alias', '/q', 'exit' - invoke '/alias', '/h', 'help' } def highlighter = new SystemHighlighter(commandHighlighter, argsHighlighter, groovyHighlighter).tap { diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyConsoleEngine.groovy b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyConsoleEngine.groovy index 8e7dd3bb74..df37e643c7 100644 --- a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyConsoleEngine.groovy +++ b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyConsoleEngine.groovy @@ -25,17 +25,13 @@ import org.jline.console.impl.ConsoleEngineImpl import java.nio.file.Path import java.util.function.Supplier -import java.util.regex.Matcher -import java.util.regex.Pattern class GroovyConsoleEngine extends ConsoleEngineImpl { private final Printer printer - private final ScriptEngine engine GroovyConsoleEngine(ScriptEngine engine, Printer printer, Supplier<Path> workDir, ConfigurationPath configPath) { super(Command.values().toSet() - Command.SLURP, engine, printer, workDir, configPath) this.printer = printer - this.engine = engine commandNames().each{ name -> rename(Command."${name.toUpperCase()}", "/$name") } } @@ -43,50 +39,6 @@ class GroovyConsoleEngine extends ConsoleEngineImpl { printer.println(options, object) } - // TODO remove if PR JLine#1371 accepted upstream - @Override - Object[] expandParameters(String[] args) throws Exception { - Object[] out = new Object[args.length] - String regexPath = /(.*)\$\{(.*?)}(\/.*)/ - for (int i = 0; i < args.length; i++) { - if (args[i].matches(regexPath)) { - Matcher matcher = Pattern.compile(regexPath).matcher(args[i]) - if (matcher.find()) { - out[i] = matcher.group(1) + engine.get(matcher.group(2)) + matcher.group(3) - } else { - throw new IllegalArgumentException() - } - } else if (args[i].startsWith('${')) { - String expanded = expandName(args[i]) - String statement = expanded.startsWith('$') ? args[i][2..-2] : expanded - out[i] = engine.execute(statement) - } else if (args[i].startsWith('$')) { - out[i] = engine.get(expandName(args[i])) - } else { - out[i] = engine.deserialize(args[i]) - } - } - out - } - - // can be removed if the following PR is merged and released - // https://github.com/jline/jline3/pull/1357 - private static String expandName(String name) { - String regexVar = "[a-zA-Z_][a-zA-Z0-9_-]*" - String out = name - if (name.matches('^\\$' + regexVar)) { - out = name.substring(1) - } else if (name.matches('^\\$\\{' + regexVar + '}.*')) { - Matcher matcher = Pattern.compile('^\\$\\{(' + regexVar + ')}(.*)').matcher(name) - if (matcher.find()) { - out = matcher.group(1) + matcher.group(2) - } else { - throw new IllegalArgumentException() - } - } - return out - } - @Override String name() { 'Console Commands' diff --git a/versions.properties b/versions.properties index 98be9dd586..2374aa32a8 100644 --- a/versions.properties +++ b/versions.properties @@ -36,7 +36,7 @@ jansi=2.4.2 jarjar=1.14.1 javaParser=3.27.0 jcipAnnotations=1.0 -jline=3.30.4 +jline=3.30.5 jmh=1.37 jqwik=1.9.3 jruby=9.2.17.0
