JAL-629 Commands more objecty, less classy. FileLoader with sync option (or rather...
[jalview.git] / src / jalview / bin / Jalview.java
index b5def09..a728bc8 100755 (executable)
@@ -126,6 +126,8 @@ public class Jalview
 
   private Desktop desktop;
 
+  protected Commands cmds;
+
   public static AlignFrame currentAlignFrame;
 
   static
@@ -641,12 +643,16 @@ public class Jalview
       }
     }
     // Run Commands from cli
-    boolean commandsSuccess = Commands.processArgs(argparser, headlessArg);
+    cmds = new Commands(argparser, headlessArg);
+    boolean commandsSuccess = cmds.argsWereParsed();
     if (commandsSuccess)
     {
       Console.info("Successfully completed commands");
       if (headlessArg)
+      {
+        System.out.println("#### EXITING");
         System.exit(0);
+      }
     }
     else
     {
@@ -971,7 +977,7 @@ public class Jalview
 
     if (!Platform.isJS() && !headless && file == null
             && Cache.getDefault("SHOW_STARTUP_FILE", true)
-            && !Commands.commandArgsProvided())
+            && !cmds.commandArgsProvided())
     // don't open the startup file if command line args have been processed
     // (&& !Commands.commandArgsProvided())
     /**
@@ -1572,6 +1578,7 @@ public class Jalview
   public void quit()
   {
     // System.exit will run the shutdownHook first
+    System.out.println("Quitting now. Bye!");
     System.exit(0);
   }
 
@@ -1584,4 +1591,9 @@ public class Jalview
   {
     Jalview.currentAlignFrame = currentAlignFrame;
   }
+
+  protected Commands getCommands()
+  {
+    return cmds;
+  }
 }