changeset 2552:51bf307c74e5

LauncherImpl.run() should work at one level of abstraction Reviewed-by: aazores Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-December/021909.html
author Omair Majid <omajid@redhat.com>
date Thu, 29 Dec 2016 12:06:25 -0500
parents b1f77c58792e
children 59c314511010
files launcher/src/main/java/com/redhat/thermostat/launcher/internal/LauncherImpl.java
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/LauncherImpl.java	Fri Dec 16 15:10:42 2016 -0500
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/LauncherImpl.java	Thu Dec 29 12:06:25 2016 -0500
@@ -169,13 +169,9 @@
             if (hasNoArguments(args)) {
                 runHelpCommand();
             } else if (isVersionQuery(args, inShell)) {
-                // We want to print the version of core
-                // thermostat, so we use the no-arg constructor of Version
-                cmdCtxFactory.getConsole().getOutput().println(coreVersion.getVersionInfo());
+                showVersion();
             } else if (isInfoQuery(args, inShell)) {
-                PrintStream stdOut = cmdCtxFactory.getConsole().getOutput();
-                stdOut.println(CommonPaths.THERMOSTAT_HOME + "=" + paths.getSystemThermostatHome().getAbsolutePath());
-                stdOut.println(CommonPaths.USER_THERMOSTAT_HOME + "=" + paths.getUserThermostatHome().getAbsolutePath());
+                showInfo();
             } else {
                 // With web-always-on we need to make sure that the setup ran.
                 if (isSomeHelpInvocation(args) || isThermostatConfigured()) {
@@ -508,6 +504,12 @@
         }
     }
 
+    private void showVersion() {
+        // We want to print the version of core
+        // thermostat, so we use the no-arg constructor of Version
+        cmdCtxFactory.getConsole().getOutput().println(coreVersion.getVersionInfo());
+    }
+
     private boolean isInfoQuery(String[] args, boolean inShell) {
         // don't allow --info in the shell
         if (inShell) {
@@ -516,5 +518,12 @@
             return args[0].equals(INFO_OPTION);
         }
     }
+
+    private void showInfo() {
+        PrintStream stdOut = cmdCtxFactory.getConsole().getOutput();
+        stdOut.println(CommonPaths.THERMOSTAT_HOME + "=" + paths.getSystemThermostatHome().getAbsolutePath());
+        stdOut.println(CommonPaths.USER_THERMOSTAT_HOME + "=" + paths.getUserThermostatHome().getAbsolutePath());
+    }
+
 }