JAL-629 added eps and imagemap. Added --output and --format with test. Adjusted...
[jalview.git] / src / jalview / bin / Jalview.java
index 0870ecb..4c204fa 100755 (executable)
@@ -283,12 +283,14 @@ public class Jalview
    */
   void doMain(String[] args)
   {
-
     if (!Platform.isJS())
     {
       System.setSecurityManager(null);
     }
 
+    if (args == null)
+      args = new String[] {};
+
     // Move any new getdown-launcher-new.jar into place over old
     // getdown-launcher.jar
     String appdirString = System.getProperty("getdownappdir");
@@ -318,6 +320,7 @@ public class Jalview
       {
         OutputStream devNull = new OutputStream()
         {
+
           @Override
           public void write(int b)
           {
@@ -378,7 +381,15 @@ public class Jalview
 
     try
     {
-      String logLevel = bootstrapArgs.contains(Arg.DEBUG) ? "DEBUG" : null;
+      String logLevel = null;
+      if (bootstrapArgs.contains(Arg.TRACE))
+      {
+        logLevel = "TRACE";
+      }
+      else if (bootstrapArgs.contains(Arg.DEBUG))
+      {
+        logLevel = "DEBUG";
+      }
       if (logLevel == null && !(bootstrapProperties == null))
       {
         logLevel = bootstrapProperties.getProperty(Cache.JALVIEWLOGLEVEL);
@@ -432,12 +443,14 @@ public class Jalview
     // --argfile=... -- OVERRIDES ALL NON-BOOTSTRAP ARGS
     if (bootstrapArgs.contains(Arg.ARGFILE))
     {
-      argparser = ArgParser
-              .parseArgFiles(bootstrapArgs.getList(Arg.ARGFILE));
+      argparser = ArgParser.parseArgFiles(
+              bootstrapArgs.getList(Arg.ARGFILE),
+              bootstrapArgs.getBoolean(Arg.INITSUBSTITUTIONS));
     }
     else
     {
-      argparser = new ArgParser(args);
+      argparser = new ArgParser(args,
+              bootstrapArgs.getBoolean(Arg.INITSUBSTITUTIONS));
     }
 
     if (!Platform.isJS())
@@ -447,8 +460,12 @@ public class Jalview
      * @j2sIgnore
      */
     {
-      if (aparser.contains("help") || aparser.contains("h")
-              || argparser.getBool(Arg.HELP))
+      if (bootstrapArgs.contains(Arg.HELP))
+      {
+        System.out.println(Arg.usage());
+        Jalview.exit(null, 0);
+      }
+      if (aparser.contains("help") || aparser.contains("h"))
       {
         showUsage();
         Jalview.exit(null, 0);
@@ -458,7 +475,7 @@ public class Jalview
       {
         System.setProperty("java.awt.headless", "true");
         // new
-        headlessArg = argparser.getBool(Arg.HEADLESS);
+        headlessArg = bootstrapArgs.getBoolean(Arg.HEADLESS);
       }
       if (aparser.contains("nodisplay") || aparser.contains("nogui")
               || aparser.contains("headless"))
@@ -520,7 +537,7 @@ public class Jalview
         }
         // DISABLED FOR SECURITY REASONS
         // TODO: add a property to allow properties to be overriden by cli args
-        // Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
+        // Cache.setProperty(setprop.substring(0,p), setprop.substring(p+1));
       }
     }
     if (System.getProperty("java.awt.headless") != null
@@ -561,7 +578,8 @@ public class Jalview
     if (!(headless || headlessArg))
     {
       Desktop.nosplash = "false".equals(bootstrapArgs.get(Arg.SPLASH))
-              || aparser.contains("nosplash");
+              || aparser.contains("nosplash")
+              || Cache.getDefault("SPLASH", "true").equals("false");
       desktop = new Desktop();
       desktop.setInBatchMode(true); // indicate we are starting up
 
@@ -621,7 +639,12 @@ public class Jalview
           }
         }
 
-        if (!aparser.contains("nowebservicediscovery"))
+        boolean doWebServiceDiscovery = !aparser
+                .contains("nowebservicediscovery");
+        if (bootstrapArgs.contains(Arg.WEBSERVICEDISCOVERY))
+          doWebServiceDiscovery = bootstrapArgs
+                  .getBoolean(Arg.WEBSERVICEDISCOVERY);
+        if (doWebServiceDiscovery)
         {
           desktop.startServiceDiscovery();
         }