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/02/14 13:44:21 UTC

[11/15] git commit: [KARAF-2756] Use @Completer for shell commands

[KARAF-2756] Use @Completer for shell commands


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

Branch: refs/heads/master
Commit: 22bae92410976befe0a56b1f4f29ee55ff2e0eff
Parents: fe817d2
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Fri Feb 14 13:28:22 2014 +0100
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Fri Feb 14 13:43:58 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/karaf/shell/commands/impl/WatchAction.java  | 3 +++
 .../src/main/resources/OSGI-INF/blueprint/shell-commands.xml    | 5 +----
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/22bae924/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java
index 7edcb9b..2850c76 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java
@@ -28,8 +28,10 @@ import org.apache.felix.service.command.CommandProcessor;
 import org.apache.felix.service.command.CommandSession;
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Completer;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.AbstractAction;
+import org.apache.karaf.shell.console.completer.CommandsCompleter;
 
 @Command(scope = "shell", name = "watch", description = "Watches & refreshes the output of a command")
 public class WatchAction extends AbstractAction {
@@ -41,6 +43,7 @@ public class WatchAction extends AbstractAction {
     private boolean append = false;
 
     @Argument(index = 0, name = "command", description = "The command to watch / refresh", required = true, multiValued = true)
+    @Completer(CommandsCompleter.class)
     private String[] arguments;
 
     CommandProcessor commandProcessor;

http://git-wip-us.apache.org/repos/asf/karaf/blob/22bae924/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml b/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml
index 45c547c..9258998 100644
--- a/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml
+++ b/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml
@@ -101,10 +101,6 @@
             <action class="org.apache.karaf.shell.commands.impl.WatchAction">
                 <property name="commandProcessor" ref="commandProcessor"/>
             </action>
-            <completers>
-                <ref component-id="commandCompleter" />
-                <null/>
-            </completers>
         </command>
         <command>
             <action class="org.apache.karaf.shell.commands.impl.WcAction"/>
@@ -117,6 +113,7 @@
     </command-bundle>
 
    <bean id="commandCompleter" class="org.apache.karaf.shell.console.completer.CommandsCompleter"/>
+   <service ref="commandCompleter" auto-export="all-classes"/>
 
    <bean class="org.osgi.util.tracker.BundleTracker" init-method="open"
         destroy-method="close">