Mercurial > hg > release > thermostat-1.4
changeset 1824:96c0923a42e3
[1.4] Support hostId completions in thermostat shell.
Reviewed-by: omajid
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2015-October/016605.html
PR2658
author | Severin Gehwolf <sgehwolf@redhat.com> |
---|---|
date | Thu, 01 Oct 2015 14:24:31 +0200 |
parents | 5f6dea7aad8f |
children | 2ae8438ee9d2 |
files | launcher/src/main/java/com/redhat/thermostat/launcher/internal/TabCompletion.java |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/TabCompletion.java Thu Sep 24 18:23:53 2015 +0200 +++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/TabCompletion.java Thu Oct 01 14:24:31 2015 +0200 @@ -55,6 +55,11 @@ private static final String LONG_OPTION_PREFIX = "--"; private static final String SHORT_OPTION_PREFIX = "-"; + private static final String LOG_LEVEL_LONG_OPTION = "logLevel"; + private static final String VMID_LONG_OPTION = "vmId"; + private static final String AGENTID_LONG_OPTION = "agentId"; + private static final String HOSTID_LONG_OPTION = "hostId"; + private static final String DB_URL_LONG_OPTION = "dbUrl"; public static void setupTabCompletion(ConsoleReader reader, CommandInfoSource commandInfoSource, BundleContext context, StorageState storageState, ClientPreferences prefs) { List<String> logLevels = new ArrayList<>(); @@ -73,13 +78,13 @@ TreeCompleter.Node command = createStringNode(commandName); for (Option option : (Collection<Option>) info.getOptions().getOptions()) { - if (option.getLongOpt().equals("logLevel")) { + if (option.getLongOpt().equals(LOG_LEVEL_LONG_OPTION)) { setupCompletion(command, option, new StringsCompleter(logLevels)); - } else if (option.getLongOpt().equals("vmId")) { + } else if (option.getLongOpt().equals(VMID_LONG_OPTION)) { setupCompletion(command, option, new IdCompleter(new VmIdsFinder(context), storageState)); - } else if (option.getLongOpt().equals("agentId")) { + } else if (option.getLongOpt().equals(AGENTID_LONG_OPTION) || option.getLongOpt().equals(HOSTID_LONG_OPTION)) { setupCompletion(command, option, new IdCompleter(new AgentIdsFinder(context), storageState)); - } else if (option.getLongOpt().equals("dbUrl")) { + } else if (option.getLongOpt().equals(DB_URL_LONG_OPTION)) { setupCompletion(command, option, new DbUrlCompleter(prefs)); } else { setupDefaultCompletion(command, option);