Fix completers for CLI app command
Change-Id: I4a480e326202e67440ee05520514a26e78b308ef
diff --git a/cli/src/main/java/org/onosproject/cli/app/AllApplicationNamesCompleter.java b/cli/src/main/java/org/onosproject/cli/app/AllApplicationNamesCompleter.java
index f501fd2..d04e087 100644
--- a/cli/src/main/java/org/onosproject/cli/app/AllApplicationNamesCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/app/AllApplicationNamesCompleter.java
@@ -21,6 +21,7 @@
import java.util.Spliterators;
import java.util.stream.StreamSupport;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.app.ApplicationService;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.core.Application;
@@ -32,6 +33,7 @@
/**
* All installed application name completer.
*/
+@Service
public class AllApplicationNamesCompleter extends AbstractChoicesCompleter {
@Override
public List<String> choices() {
diff --git a/cli/src/main/java/org/onosproject/cli/app/ApplicationCommand.java b/cli/src/main/java/org/onosproject/cli/app/ApplicationCommand.java
index 55e7a93..ff0cbf8 100644
--- a/cli/src/main/java/org/onosproject/cli/app/ApplicationCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/app/ApplicationCommand.java
@@ -18,6 +18,7 @@
import com.google.common.io.ByteStreams;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.app.ApplicationAdminService;
import org.onosproject.cli.AbstractShellCommand;
@@ -45,11 +46,13 @@
@Argument(index = 0, name = "command",
description = "Command name (install|activate|deactivate|uninstall|download)",
- required = true, multiValued = false)
+ required = true)
+ @Completion(ApplicationCommandCompleter.class)
String command = null;
@Argument(index = 1, name = "names", description = "Application name(s) or URL(s)",
required = true, multiValued = true)
+ @Completion(ApplicationNameCompleter.class)
String[] names = null;
@Override
diff --git a/cli/src/main/java/org/onosproject/cli/app/ApplicationCommandCompleter.java b/cli/src/main/java/org/onosproject/cli/app/ApplicationCommandCompleter.java
index 8164b0e..a6487b3 100644
--- a/cli/src/main/java/org/onosproject/cli/app/ApplicationCommandCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/app/ApplicationCommandCompleter.java
@@ -16,6 +16,7 @@
package org.onosproject.cli.app;
import com.google.common.collect.ImmutableList;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractChoicesCompleter;
import java.util.List;
@@ -25,6 +26,7 @@
/**
* Application command completer.
*/
+@Service
public class ApplicationCommandCompleter extends AbstractChoicesCompleter {
@Override
public List<String> choices() {
diff --git a/cli/src/main/java/org/onosproject/cli/app/ApplicationNameCompleter.java b/cli/src/main/java/org/onosproject/cli/app/ApplicationNameCompleter.java
index badbcd8..2d0a6f7 100644
--- a/cli/src/main/java/org/onosproject/cli/app/ApplicationNameCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/app/ApplicationNameCompleter.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.cli.app;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.apache.karaf.shell.api.console.CommandLine;
import org.apache.karaf.shell.api.console.Session;
import org.apache.karaf.shell.support.completers.StringsCompleter;
@@ -43,6 +44,7 @@
/**
* Application name completer.
*/
+@Service
public class ApplicationNameCompleter extends AbstractCompleter {
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {