Merge branch 'develop' into feature/JAL-3416_update_to_flatlaf_3.1.1_with_unpacked_na...
[jalview.git] / src / jalview / bin / argparser / Arg.java
index 8003245..8bac623 100644 (file)
@@ -128,14 +128,10 @@ public enum Arg
                   + "none,\n" + "jmol,\n" + "chimera,\n" + "chimerax,\n"
                   + "pymol.",
           Opt.STRING, Opt.LINKED, Opt.MULTI),
-  STRUCTUREIMAGE(Type.STRUCTURE,
-          "Export an image of a 3D structure opened in JMOL", Opt.STRING,
-          Opt.LINKED, Opt.MULTI),
   NOTEMPFAC(Type.STRUCTURE,
           "Do not show the temperature factor annotation for the preceding --structure.",
           Opt.UNARY, Opt.LINKED, Opt.ALLOWALL, Opt.SECRET), // keep this secret
-                                                            // until it
-  // works!
+                                                            // until it works!
   SHOWSSANNOTATIONS(Type.STRUCTURE, null, Opt.BOOLEAN, Opt.LINKED,
           Opt.ALLOWALL),
 
@@ -146,11 +142,11 @@ public enum Arg
           Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS, Opt.ALLOWALL,
           Opt.REQUIREINPUT, Opt.OUTPUT, Opt.PRIMARY),
   TYPE(Type.IMAGE,
-          "Set the image format for the preceding --image to name. Valid values for name are: svg,\n"
-                  + "png,\n" + "eps,\n" + "html,\n" + "biojs.",
+          "Set the image format for the preceding --image. Valid values are:\n"
+                  + "svg,\n" + "png,\n" + "eps,\n" + "html,\n" + "biojs.",
           Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
   TEXTRENDERER(Type.IMAGE,
-          "Sets whether text in a vector image format (SVG, HTML, EPS) should be rendered as text or vector line-art. Possible values for name are:\n"
+          "Sets whether text in a vector image format (SVG, HTML, EPS) should be rendered as text or vector line-art. Possible values are:\n"
                   + "text,\n" + "lineart.",
           Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
   SCALE(Type.IMAGE,
@@ -162,6 +158,27 @@ public enum Arg
   HEIGHT(Type.IMAGE,
           "Sets a height for bitmap image format (PNG) with the width maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --scale and --width then the smallest scaling will be used (scale, width and height provide bounds for the image).",
           Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+  STRUCTUREIMAGE(Type.STRUCTUREIMAGE,
+          "Export an image of a 3D structure opened in JMOL", Opt.STRING,
+          Opt.LINKED, Opt.MULTI),
+  STRUCTUREIMAGETYPE(Type.STRUCTUREIMAGE,
+          "Set the structure image format for the preceding --structureimage. Valid values are:\n"
+                  + "svg,\n" + "png,\n" + "eps,\n" + "html,\n" + "biojs.",
+          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+  STRUCTUREIMAGETEXTRENDERER(Type.STRUCTUREIMAGE,
+          "Sets whether text in a vector structure image format (SVG, EPS) should be rendered as text or vector line-art. Possible values are:\n"
+                  + "text,\n" + "lineart.",
+          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+  STRUCTUREIMAGESCALE(Type.STRUCTUREIMAGE,
+          "Sets a scaling for bitmap structure image format (PNG). Should be given as a floating point number. If used in conjunction with --structureimagewidth and --structureimageheight then the smallest scaling will be used (structureimagescale, structureimagewidth and structureimageheight provide bounds for the structure image).",
+          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+  STRUCTUREIMAGEWIDTH(Type.STRUCTUREIMAGE,
+          "Sets a width for bitmap structure image format (PNG) with the height maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --structureimagescale and --structureimageheight then the smallest scaling will be used (structureimagescale, structureimagewidth and structureimageheight provide bounds for the structure image).",
+          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+  STRUCTUREIMAGEHEIGHT(Type.STRUCTUREIMAGE,
+          "Sets a height for bitmap structure image format (PNG) with the width maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --structureimagescale and --structureimagewidth then the smallest scaling will be used (structureimagescale, structureimagewidth and structureimageheight provide bounds for the structure image).",
+          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+
   OUTPUT(Type.OUTPUT,
           "Export the open alignment to file filename. The format name is specified by the subval modifier format=name, a following --format name argument or guessed from the file extension. Valid format names (and file extensions) are:\n"
                   + "fasta (fa, fasta, mfa, fastq),\n" + "pfam (pfam),\n"
@@ -224,6 +241,12 @@ public enum Arg
   QUIT(Type.FLOW,
           "After all files have been opened, appended and output, quit Jalview. In ‑‑headless mode this already happens.",
           Opt.UNARY),
+  NOQUIT(Type.FLOW,
+          "Secret arg to not quit after --headless mode for tests",
+          Opt.UNARY, Opt.SECRET),
+  ALLSTRUCTURES(Type.FLOW,
+          "Apply the following 3D structure formatting arguments to all structures within the open alignment.",
+          Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION),
 
   // secret options
   TESTOUTPUT(Type.CONFIG,
@@ -323,6 +346,7 @@ public enum Arg
     PROCESS("arguments used to process an alignment once opened"),
     OUTPUT("arguments used to save data from a processed alignment"),
     IMAGE("arguments used to export an image of an alignment"),
+    STRUCTUREIMAGE("arguments used to export an image of an structure"),
     FLOW("arguments that control processing of the other arguments"), //
     ALL("all arguments"), // mostly just a place-holder for --help-all
     NONE, // mostly a place-holder for --help
@@ -522,9 +546,9 @@ public enum Arg
   {
     StringBuilder sb = new StringBuilder();
 
-    sb.append("usage: jalview [" + Arg.HEADLESS.argString() + "] ["
+    sb.append("usage: jalview [" + Arg.HEADLESS.argString() + "] [["
             + Arg.OPEN.argString() + "/" + Arg.APPEND.argString()
-            + " file(s)] [args]");
+            + "] file(s)] [args]");
     sb.append(System.lineSeparator());
     sb.append(System.lineSeparator());
 
@@ -567,6 +591,7 @@ public enum Arg
       }
 
       Iterator<Arg> argsI = args.iterator();
+      Type typeSection = null;
       while (argsI.hasNext())
       {
         Arg a = argsI.next();
@@ -577,10 +602,27 @@ public enum Arg
           continue;
         }
 
+        if (a.getType() != typeSection)
+        {
+          typeSection = a.getType();
+          String typeDescription = a.getType().description();
+          if (typeDescription != null && typeDescription.length() > 0)
+          {
+            // typeDescription = typeDescription.substring(0,
+            // 1).toUpperCase(Locale.ROOT) + typeDescription.substring(1);
+            typeDescription = typeDescription.toUpperCase(Locale.ROOT);
+            sb.append(typeDescription);
+            sb.append(System.lineSeparator());
+            sb.append(System.lineSeparator());
+          }
+        }
+
         appendArgUsage(sb, a, maxArgLength);
 
         if (argsI.hasNext())
+        {
           sb.append(System.lineSeparator());
+        }
       }
     }
     return sb.toString();