You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/07/11 13:10:18 UTC

[2/3] git commit: [KARAF-1553] Fix help command

[KARAF-1553] Fix help command


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/b9bb686b
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/b9bb686b
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/b9bb686b

Branch: refs/heads/karaf-3.0.x
Commit: b9bb686bb49bf887eabfa0b95f3ffa59e2befcc0
Parents: bb9c147
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Thu Jul 10 18:42:25 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Fri Jul 11 12:26:24 2014 +0200

----------------------------------------------------------------------
 .../apache/karaf/shell/help/impl/CommandListHelpProvider.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/b9bb686b/shell/help/src/main/java/org/apache/karaf/shell/help/impl/CommandListHelpProvider.java
----------------------------------------------------------------------
diff --git a/shell/help/src/main/java/org/apache/karaf/shell/help/impl/CommandListHelpProvider.java b/shell/help/src/main/java/org/apache/karaf/shell/help/impl/CommandListHelpProvider.java
index 4f901a6..caf42de 100644
--- a/shell/help/src/main/java/org/apache/karaf/shell/help/impl/CommandListHelpProvider.java
+++ b/shell/help/src/main/java/org/apache/karaf/shell/help/impl/CommandListHelpProvider.java
@@ -31,6 +31,7 @@ import org.apache.felix.gogo.commands.Action;
 import org.apache.felix.service.command.CommandSession;
 import org.apache.felix.service.command.Function;
 import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.CommandWithAction;
 import org.apache.karaf.shell.commands.basic.AbstractCommand;
 import org.apache.karaf.shell.commands.meta.ActionMetaDataFactory;
 import org.apache.karaf.shell.console.HelpProvider;
@@ -92,9 +93,9 @@ public class CommandListHelpProvider implements HelpProvider {
             String description = null;
             Function function = (Function) session.get(name);
             function = unProxy(function);
-            if (function instanceof AbstractCommand) {
+            if (function instanceof CommandWithAction) {
                 try {
-                    Class<? extends Action> actionClass = ((AbstractCommand) function).getActionClass();                    
+                    Class<? extends Action> actionClass = ((CommandWithAction) function).getActionClass();
                     Command ann = new ActionMetaDataFactory().getCommand(actionClass);
                     description = ann.description();
                 } catch (Throwable e) {
@@ -102,7 +103,7 @@ public class CommandListHelpProvider implements HelpProvider {
                 if (name.startsWith("*:")) {
                     name = name.substring(2);
                 }
-                if (subshell != null && !subshell.trim().isEmpty() && name.startsWith(subshell)) {
+                if (subshell != null && !subshell.trim().isEmpty() && name.startsWith(subshell + ":")) {
                     name = name.substring(subshell.length() + 1);
                 }
                 commands.put(name, description);