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 229773bef3 GROOVY-8162: Update Groovysh to JLine3 (more streamlined 
/grab completions)
229773bef3 is described below

commit 229773bef367de026600d19c45e5acd08e9f0249
Author: Paul King <pa...@asert.com.au>
AuthorDate: Thu Aug 14 08:13:24 2025 +1000

    GROOVY-8162: Update Groovysh to JLine3 (more streamlined /grab completions)
---
 .../groovy/groovysh/jline/MavenCoordinateCompleter.groovy     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/MavenCoordinateCompleter.groovy
 
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/MavenCoordinateCompleter.groovy
index a6832122bd..e22998117d 100644
--- 
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/MavenCoordinateCompleter.groovy
+++ 
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/MavenCoordinateCompleter.groovy
@@ -94,7 +94,7 @@ class MavenCoordinateCompleter implements Completer {
             groupDir.eachDir { artifactDir ->
                 if (artifactDir.name.startsWith(artifactPrefix) && 
isVersionDirPresent(artifactDir)) {
                     def suggestion = "${groupId}:${artifactDir.name}:"
-                    candidates << new Candidate(suggestion, suggestion, null, 
null, '', null, false)
+                    candidates << new Candidate(suggestion, 
"${artifactDir.name}:", null, null, '', null, false)
                 }
             }
         }
@@ -104,7 +104,7 @@ class MavenCoordinateCompleter implements Completer {
         groupDir.eachDir { artifactDir ->
             if (artifactDir.name.startsWith(artifactPrefix) && 
isJarsDirPresent(artifactDir)) {
                 def suggestion = "${groupId}:${artifactDir.name}:"
-                candidates << new Candidate(suggestion, suggestion, null, 
null, '', null, false)
+                candidates << new Candidate(suggestion, 
"${artifactDir.name}:", null, null, '', null, false)
             }
         }
     }
@@ -115,7 +115,7 @@ class MavenCoordinateCompleter implements Completer {
             artifactDir.eachDir { versionDir ->
                 if (versionDir.name.startsWith(versionPrefix)) {
                     def suggestion = 
"${groupId}:${artifactId}:${versionDir.name}"
-                    candidates << new Candidate(suggestion, suggestion, null, 
null, ' ', null, true)
+                    candidates << new Candidate(suggestion, 
"${versionDir.name}", null, null, ' ', null, true)
                 }
             }
         }
@@ -124,8 +124,9 @@ class MavenCoordinateCompleter implements Completer {
         if (!artifactDir.exists()) return
         artifactDir.eachFile { candidate ->
             if (candidate.name.startsWith("$artifactId-$versionPrefix") && 
candidate.name.endsWith('.jar')) {
-                def suggestion = /$groupId:$artifactId:${(candidate.name - 
'.jar') - "$artifactId-"}/
-                candidates << new Candidate(suggestion, suggestion, null, 
null, ' ', null, true)
+                def version = candidate.name - "$artifactId-" - '.jar'
+                def suggestion = "$groupId:$artifactId:$version"
+                candidates << new Candidate(suggestion, version, null, null, ' 
', null, true)
             }
         }
     }

Reply via email to