changeset 2466:6302ed7dc808

AbstractCompleterCommand provides default CompleterService implementations Reviewed-by: jkang Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-September/020993.html
author Andrew Azores <aazores@redhat.com>
date Wed, 28 Sep 2016 11:35:58 -0400
parents 6eb9411e5d89
children 4afe4cd04523
files common/core/src/main/java/com/redhat/thermostat/common/cli/AbstractCompleterCommand.java dev/storage-populator/command/src/main/java/com/redhat/thermostat/storage/populator/StoragePopulatorCommand.java vm-byteman/client-cli/src/main/java/com/redhat/thermostat/vm/byteman/client/cli/BytemanControlCommand.java
diffstat 3 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/common/core/src/main/java/com/redhat/thermostat/common/cli/AbstractCompleterCommand.java	Fri Sep 23 17:13:44 2016 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/cli/AbstractCompleterCommand.java	Wed Sep 28 11:35:58 2016 -0400
@@ -41,13 +41,14 @@
 import org.osgi.service.component.ComponentContext;
 
 import java.util.Collections;
+import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 
 /**
- * An abstract class to help with implementing commands which also provide tab completions for arguments within
- * Thermostat shell. This is most useful in cases where an argument and its completions are unique to a single
- * command; if your plugin provides multiple commands which have shared options and shared arguments/completions,
+ * An abstract class to help with implementing commands which also provide tab completions for arguments and sub-
+ * commands within Thermostat shell. This is most useful in cases where an argument and its completions are unique to a
+ * single command; if your plugin provides multiple commands which have shared options and shared arguments/completions,
  * more flexibility in the implementation can be had by implementing a {@link CompleterService} directly and separately
  * from the Command implementations.
  *
@@ -85,4 +86,13 @@
         return Objects.requireNonNull(name, t.localize(LocaleResources.MISSING_COMMAND_NAME, getClass().getName()).getContents());
     }
 
+    @Override
+    public Map<CliCommandOption, ? extends TabCompleter> getOptionCompleters() {
+        return Collections.emptyMap();
+    }
+
+    @Override
+    public Map<String, Map<CliCommandOption, ? extends TabCompleter>> getSubcommandCompleters() {
+        return Collections.emptyMap();
+    }
 }
--- a/dev/storage-populator/command/src/main/java/com/redhat/thermostat/storage/populator/StoragePopulatorCommand.java	Fri Sep 23 17:13:44 2016 +0200
+++ b/dev/storage-populator/command/src/main/java/com/redhat/thermostat/storage/populator/StoragePopulatorCommand.java	Wed Sep 28 11:35:58 2016 -0400
@@ -165,11 +165,6 @@
     }
 
     @Override
-    public Map<String, Map<CliCommandOption, ? extends TabCompleter>> getSubcommandCompleters() {
-        return Collections.emptyMap();
-    }
-
-    @Override
     public void run(CommandContext ctx) throws CommandException {
         console = ctx.getConsole();
 
--- a/vm-byteman/client-cli/src/main/java/com/redhat/thermostat/vm/byteman/client/cli/BytemanControlCommand.java	Fri Sep 23 17:13:44 2016 +0200
+++ b/vm-byteman/client-cli/src/main/java/com/redhat/thermostat/vm/byteman/client/cli/BytemanControlCommand.java	Wed Sep 28 11:35:58 2016 -0400
@@ -122,11 +122,6 @@
     }
 
     @Override
-    public Map<String, Map<CliCommandOption, ? extends TabCompleter>> getSubcommandCompleters() {
-        return Collections.emptyMap();
-    }
-
-    @Override
     public void run(CommandContext ctx) throws CommandException {
         VmArgument vmArgument = VmArgument.required(ctx.getArguments());
         VmId vmId = vmArgument.getVmId();