jamesfredley commented on code in PR #15367:
URL: https://github.com/apache/grails-core/pull/15367#discussion_r2748835381


##########
grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/HelpCommand.groovy:
##########
@@ -113,20 +116,20 @@ grails [environment]* [target] [arguments]*'
     }
 
     @Override
-    int complete(String buffer, int cursor, List<CharSequence> candidates) {
+    void complete(LineReader reader, ParsedLine line, List<Candidate> 
candidates) {
         def allCommands = findAllCommands().collect() { CommandDescription 
desc -> desc.name }
+        String buffer = line.word()
 
         for (cmd in allCommands) {
             if (buffer) {
                 if (cmd.startsWith(buffer)) {
-                    candidates << cmd.substring(buffer.size())
+                    candidates.add(new Candidate(cmd))
                 }
             }
             else {
-                candidates << cmd
+                candidates.add(new Candidate(cmd))
             }
         }

Review Comment:
   Fixed in commit 0cf49b2383 - simplified the completion logic by combining 
the if/else branches into a single condition: `if (!buffer || 
cmd.startsWith(buffer))`. This achieves the same behavior since 
`startsWith("")` returns true for all strings.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to