JAL-4193 JAL-4194 sessionProperties layer in Cache, CLI arg Opts to deal with -Pkey...
[jalview.git] / src / jalview / bin / Jalview.java
index dc97549..b29d9d7 100755 (executable)
@@ -343,6 +343,25 @@ public class Jalview
       }
     }
 
+    // set individual session preferences
+    if (bootstrapArgs.contains(Arg.P))
+    {
+      for (String kev : bootstrapArgs.getValueList(Arg.P))
+      {
+        if (kev == null)
+        {
+          continue;
+        }
+        int equalsIndex = kev.indexOf(ArgParser.EQUALS);
+        if (equalsIndex > -1)
+        {
+          String key = kev.substring(0, equalsIndex);
+          String val = kev.substring(equalsIndex + 1);
+          Cache.setSessionProperty(key, val);
+        }
+      }
+    }
+
     // Move any new getdown-launcher-new.jar into place over old
     // getdown-launcher.jar
     String appdirString = System.getProperty("getdownappdir");
@@ -720,18 +739,18 @@ public class Jalview
           testoutput(argparser, Arg.WEBSERVICEDISCOVERY);
         }
 
-        boolean usagestats = bootstrapArgs.getBoolean(Arg.USAGESTATS);
+        boolean usagestats = !bootstrapArgs.getBoolean(Arg.NOUSAGESTATS);
         if (aparser.contains("nousagestats"))
           usagestats = false;
         if (usagestats)
         {
           startUsageStats(desktop);
-          testoutput(argparser, Arg.USAGESTATS);
+          testoutput(argparser, Arg.NOUSAGESTATS);
         }
         else
         {
           System.out.println("CMD [-nousagestats] executed successfully!");
-          testoutput(argparser, Arg.USAGESTATS);
+          testoutput(argparser, Arg.NOUSAGESTATS);
         }
 
         boolean questionnaire = bootstrapArgs.getBoolean(Arg.QUESTIONNAIRE);
@@ -1114,7 +1133,8 @@ public class Jalview
 
     if (!Platform.isJS() && !headless && file == null
             && Cache.getDefault("SHOW_STARTUP_FILE", true)
-            && !cmds.commandArgsProvided())
+            && !cmds.commandArgsProvided()
+            && !bootstrapArgs.getBoolean(Arg.NOSTARTUPFILE))
     // don't open the startup file if command line args have been processed
     // (&& !Commands.commandArgsProvided())
     /**
@@ -1840,7 +1860,7 @@ public class Jalview
   }
 
   /*
-   * testoutput for boolean values
+   * testoutput for boolean and unary values
    */
   protected static void testoutput(ArgParser ap, Arg a)
   {
@@ -1883,7 +1903,15 @@ public class Jalview
 
   private static void testoutput(boolean yes, Arg a)
   {
-    System.out.println("[TESTOUTPUT] arg "
-            + (yes ? a.argString() : a.negateArgString()) + " was set");
+    String message = null;
+    if (a.hasOption(Opt.BOOLEAN))
+    {
+      message = (yes ? a.argString() : a.negateArgString()) + " was set";
+    }
+    else if (a.hasOption(Opt.UNARY))
+    {
+      message = a.argString() + (yes ? " was set" : " was not set");
+    }
+    System.out.println("[TESTOUTPUT] arg " + message);
   }
 }