This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch karaf-4.1.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.1.x by this push:
     new 327b46e  [KARAF-5665] Sometimes the command description does not show 
when listing commands with "TAB"
327b46e is described below

commit 327b46e5d2b519f123f830df1b50c96e37f98a73
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Tue Mar 13 08:11:30 2018 +0100

    [KARAF-5665] Sometimes the command description does not show when listing 
commands with "TAB"
---
 .../apache/karaf/shell/impl/console/ConsoleSessionImpl.java    | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git 
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
 
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
index dc2db13..46ab0dc 100644
--- 
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
+++ 
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
@@ -177,6 +177,7 @@ public class ConsoleSessionImpl implements Session {
                     .completer((rdr, line, candidates) -> {
                         builtinCompleter.complete(rdr, line, candidates);
                         commandsCompleter.complete(rdr, line, candidates);
+                                   merge(candidates);
                     })
                     .build();
 
@@ -231,6 +232,15 @@ public class ConsoleSessionImpl implements Session {
 
     }
 
+    private void merge(List<Candidate> candidates) {
+        Map<String, Candidate> map = new HashMap<>();
+        for (Candidate c : candidates) {
+            map.merge(c.value(), c, (c1, c2) -> c1.descr() != null ? c1 : c2);
+        }
+        candidates.clear();
+        candidates.addAll(map.values());
+    }
+
     /**
      * Subclasses can override to use a different history file.
      *

-- 
To stop receiving notification emails like this one, please contact
gno...@apache.org.

Reply via email to