Revert "JAL-629 Add a --threads argument to allow a limited multiple number of alignf...
[jalview.git] / src / jalview / bin / argparser / Arg.java
index 02584fb..a18057c 100644 (file)
@@ -15,7 +15,11 @@ public enum Arg
 {
 
   // Initialising arguments (BOOTSTRAP)
-  HELP("Display this help statement", Opt.UNARY, Opt.BOOTSTRAP),
+  HELP("h", "Display this help statement", Opt.UNARY, Opt.BOOTSTRAP),
+  VERSION("v",
+          "Display the version of "
+                  + ChannelProperties.getProperty("app_name"),
+          Opt.UNARY, Opt.BOOTSTRAP),
   HEADLESS(
           "Run Jalview in headless mode. No GUI interface will be created and Jalview will quit after all arguments have been processed.",
           Opt.UNARY, Opt.BOOTSTRAP),
@@ -33,82 +37,99 @@ public enum Arg
   WEBSERVICEDISCOVERY(
           "Attempt (or don't attempt) to connect to JABAWS web services.",
           true, Opt.BOOLEAN, Opt.BOOTSTRAP),
-  PROPS("Use file filename as the preferences file instead of the usual ~/.jalview_properties file.",
-          Opt.STRING, Opt.BOOTSTRAP),
-  DEBUG("Start Jalview in debug log level.", Opt.BOOLEAN, Opt.BOOTSTRAP),
+  PROPS("Use a file as the preferences file instead of the usual ~/"
+          + ChannelProperties.getProperty("preferences.filename")
+          + " file.", Opt.STRING, Opt.BOOTSTRAP),
+  DEBUG("d", "Start Jalview in debug log level.", Opt.BOOLEAN,
+          Opt.BOOTSTRAP),
   TRACE("Start Jalview in trace log level.", Opt.BOOLEAN, Opt.BOOTSTRAP,
           Opt.SECRET),
-  QUIET("Stop all output to STDOUT (after the Java Virtual Machine has started). Use ‑‑quiet a second time to stop all output to STDERR.",
+  QUIET("q",
+          "Stop all output to STDOUT (after the Java Virtual Machine has started). Use ‑‑quiet a second time to stop all output to STDERR.",
           Opt.UNARY, Opt.MULTI, Opt.BOOTSTRAP),
   INITSUBSTITUTIONS(
-          "Assume that ‑‑substitutions are initially enabled (or initially disabled).",
+          "Set ‑‑substitutions to be initially enabled (or initially disabled).",
           true, Opt.BOOLEAN, Opt.BOOTSTRAP, Opt.NOACTION),
 
   // Opening an alignment
-  OPEN("Opens one or more alignment files filename or URLs URL in new alignment windows.",
+  OPEN("Opens one or more alignment files or URLs in new alignment windows.",
           Opt.STRING, Opt.LINKED, Opt.INCREMENTDEFAULTCOUNTER, Opt.MULTI,
-          Opt.GLOB, Opt.ALLOWSUBSTITUTIONS, Opt.INPUT),
-  APPEND("Appends one or more alignment files filename or URLs URL to the open alignment window (or opens a new alignment if none already open).",
+          Opt.GLOB, Opt.ALLOWSUBSTITUTIONS, Opt.INPUT, Opt.STORED),
+  APPEND("Appends one or more alignment files or URLs to the open alignment window (or opens a new alignment if none already open).",
           Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.GLOB,
           Opt.ALLOWSUBSTITUTIONS, Opt.INPUT),
   TITLE("Specifies the title for the open alignment window as string.",
           Opt.STRING, Opt.LINKED),
-  COLOUR("Applies the colour scheme to the open alignment window. Valid values are:\n"
-          + "clustal,\n" + "blosum62,\n" + "pc-identity,\n" + "zappo,\n"
-          + "taylor,\n" + "gecos-flower,\n" + "gecos-blossom,\n"
-          + "gecos-sunset,\n" + "gecos-ocean,\n" + "hydrophobic,\n"
-          + "helix-propensity,\n" + "strand-propensity,\n"
-          + "turn-propensity,\n" + "buried-index,\n" + "nucleotide,\n"
-          + "nucleotide-ambiguity,\n" + "purine-pyrimidine,\n"
-          + "rna-helices,\n" + "t-coffee-scores,\n" + "sequence-id.",
-          Opt.STRING, Opt.LINKED),
-  FEATURES("Add a feature file filename or URL URL to the open alignment.",
-          Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
-  TREE("Add a tree file filename or URL URL to the open alignment.",
-          Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
+  COLOUR("color", // being a bit soft on the Americans!
+          "Applies the colour scheme to the open alignment window. Valid values are:\n"
+                  + "clustal,\n" + "blosum62,\n" + "pc-identity,\n"
+                  + "zappo,\n" + "taylor,\n" + "gecos-flower,\n"
+                  + "gecos-blossom,\n" + "gecos-sunset,\n"
+                  + "gecos-ocean,\n" + "hydrophobic,\n"
+                  + "helix-propensity,\n" + "strand-propensity,\n"
+                  + "turn-propensity,\n" + "buried-index,\n"
+                  + "nucleotide,\n" + "nucleotide-ambiguity,\n"
+                  + "purine-pyrimidine,\n" + "rna-helices,\n"
+                  + "t-coffee-scores,\n" + "sequence-id.",
+          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+  FEATURES("Add a feature file or URL to the open alignment.", Opt.STRING,
+          Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
+  TREE("Add a tree file or URL to the open alignment.", Opt.STRING,
+          Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
   SORTBYTREE(
-          "Enforces sorting (or not sorting) the alignment in the order of an attached phylogenetic tree.",
-          true, Opt.LINKED, Opt.BOOLEAN),
-  ANNOTATIONS(
-          "Add an annotations file filename or URL URL to the open alignment.",
+          "Enforces sorting (or not sorting) the open alignment in the order of an attached phylogenetic tree.",
+          true, Opt.LINKED, Opt.BOOLEAN, Opt.ALLOWALL),
+  ANNOTATIONS("Add an annotations file or URL to the open alignment.",
           Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
   SHOWANNOTATIONS(
           "Enforces showing (or not showing) alignment annotations.",
-          Opt.BOOLEAN, Opt.LINKED),
+          Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWALL),
   WRAP("Enforces wrapped (or not wrapped) alignment formatting.",
-          Opt.BOOLEAN, Opt.LINKED),
+          Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWALL),
   NOSTRUCTURE(
           "Do not open or process any 3D structure in the ‑‑open or ‑‑append files.",
-          Opt.UNARY, Opt.LINKED),
+          Opt.UNARY, Opt.LINKED, Opt.ALLOWALL),
 
   // Adding a 3D structure
   STRUCTURE(
-          "Load a structure file filename or URL URL associated with a sequence in the open alignment. The sequence to be associated with can be specified with a following --seqid argument, or the subval modifier seqid=ID can be used. A subval INDEX can also be used to specify the INDEX-th sequence in the open alignment.",
+          "Load a structure file or URL associated with a sequence in the open alignment.\n"
+                  + "The sequence to be associated with can be specified with a following --seqid argument, or the subval modifier seqid=ID can be used. A subval INDEX can also be used to specify the INDEX-th sequence in the open alignment.",
           Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
   SEQID("Specify the sequence name for the preceding --structure to be associated with.",
           Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
-  PAEMATRIX(
-          "Add a PAE json matrix file filename to the preceding --structure.",
+  PAEMATRIX("Add a PAE json matrix file to the preceding --structure.",
           Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
-  TEMPFAC("Set the type of temperature factor. Possible values for name are default, plddt.",
-          Opt.STRING, Opt.LINKED),
+  TEMPFAC("Set the type of temperature factor. Possible values are:\n"
+          + "default,\n" + "plddt.", Opt.STRING, Opt.LINKED),
   STRUCTUREVIEWER(
           "Set the structure viewer to use to open the 3d structure file specified in previous --structure to name. Possible values of name are:\n"
-                  + "none, jmol, chimera, chimerax, pymol.",
+                  + "none,\n" + "jmol,\n" + "chimera,\n" + "chimerax,\n"
+                  + "pymol.",
           Opt.STRING, Opt.LINKED, Opt.MULTI),
   NOTEMPFAC(
           "Do not show the temperature factor annotation for the preceding --structure.",
-          Opt.UNARY, Opt.LINKED),
-  SHOWSSANNOTATIONS(null, Opt.BOOLEAN, Opt.LINKED),
+          Opt.UNARY, Opt.LINKED, Opt.ALLOWALL, Opt.SECRET), // keep this secret
+                                                            // until it
+  // works!
+  SHOWSSANNOTATIONS(null, Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWALL),
 
   // Outputting files
-  IMAGE("Output an image of the open alignment window. Format is specified by the subval modifier, a following --type argument or guessed from the file extension. Valid formats/extensions are: svg, png, eps, html, biojs.",
+  IMAGE("Output an image of the open alignment window. Format is specified by the subval modifier, a following --type argument or guessed from the file extension. Valid formats/extensions are:\n"
+          + "svg,\n" + "png,\n" + "eps,\n" + "html,\n" + "biojs.",
           Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS, Opt.ALLOWALL,
-          Opt.REQUIREINPUT),
-  TYPE("Set the image format for the preceding --image to name. Valid values for name are: svg, png, eps, html, biojs.",
-          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+          Opt.REQUIREINPUT, Opt.OUTPUT),
+  TYPE("Set the image format for the preceding --image to name. Valid values for name are: svg,\n"
+          + "png,\n" + "eps,\n" + "html,\n" + "biojs.", Opt.STRING,
+          Opt.LINKED, Opt.ALLOWALL),
   TEXTRENDERER(
-          "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: text, lineart.",
+          "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"
+                  + "text,\n" + "lineart.",
+          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+  SCALE("Sets a scaling for bitmap image format (PNG). Should be given as a floating point number. If used in conjunction with --width and --height then the smallest scaling will be used (scale, width and height provide bounds for the image).",
+          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+  WIDTH("Sets a width for bitmap image format (PNG) with the height maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --scale and --height then the smallest scaling will be used (scale, width and height provide bounds for the image).",
+          Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+  HEIGHT("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),
   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"
@@ -116,19 +137,21 @@ public enum Arg
           + "amsa (amsa),\n" + "json (json),\n" + "pileup (pileup),\n"
           + "msf (msf),\n" + "clustal (aln),\n" + "phylip (phy),\n"
           + "jalview (jvp, jar).", Opt.STRING, Opt.LINKED,
-          Opt.ALLOWSUBSTITUTIONS, Opt.ALLOWALL, Opt.REQUIREINPUT),
+          Opt.ALLOWSUBSTITUTIONS, Opt.ALLOWALL, Opt.REQUIREINPUT,
+          Opt.OUTPUT),
   FORMAT("Sets the format for the preceding --output file. Valid formats are:\n"
           + "fasta,\n" + "pfam,\n" + "stockholm,\n" + "pir,\n" + "blc,\n"
           + "amsa,\n" + "json,\n" + "pileup,\n" + "msf,\n" + "clustal,\n"
           + "phylip,\n" + "jalview.", Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
   GROOVY("Process a groovy script in the file for the open alignment.",
-          Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
-  BACKUPS("Enable (or disable) writing backup files when saving an ‑‑output file. This applies to the current open alignment -- to apply to all ‑‑output and ‑‑image files, use after ‑‑all.",
+          Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS,
+          Opt.ALLOWALL),
+  BACKUPS("Enable (or disable) writing backup files when saving an ‑‑output file. This applies to the current open alignment.  To apply to all ‑‑output and ‑‑image files, use after ‑‑all.",
           true, Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWALL),
   OVERWRITE(
-          "Enable (or disable) overwriting of output files without backups enabled. This applies to the current open alignment -- to apply to all ‑‑output and ‑‑image files, use after ‑‑all.",
+          "Enable (or disable) overwriting of output files without backups enabled. This applies to the current open alignment.  To apply to all ‑‑output and ‑‑image files, use after ‑‑all.",
           Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWALL),
-  CLOSE("Close the current open alignment window. This occurs after other output arguments. This applies to the current open alignment -- to apply to all ‑‑output and ‑‑image files, use after ‑‑all.",
+  CLOSE("Close the current open alignment window. This occurs after other output arguments. This applies to the current open alignment.  To apply to all ‑‑output and ‑‑image files, use after ‑‑all.",
           Opt.UNARY, Opt.LINKED, Opt.ALLOWALL),
 
   // controlling flow of arguments
@@ -144,13 +167,17 @@ public enum Arg
                   + "{} - the value of the current alignment window default index.",
           true, Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION),
   ARGFILE("Open one or more files filename and read, line-by-line, as arguments to Jalview.\n"
+          + "Values in an argfile should be given with an equals sign (\"=\") separator with no spaces.\n"
           + "Note that if you use one or more --argfile arguments then all other non-initialising arguments will be ignored.",
           Opt.STRING, Opt.MULTI, Opt.BOOTSTRAP, Opt.GLOB,
           Opt.ALLOWSUBSTITUTIONS),
-  NPP("Increase the index counter used in argument value substitutions.",
+  NPP("n++",
+          "Increase the index counter used in argument value substitutions.",
           Opt.UNARY, Opt.MULTI, Opt.NOACTION),
   ALL("Apply the following output arguments to all sets of linked arguments.",
           Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION),
+  OPENED("Apply the following output arguments to all of the last --open'ed set of linked arguments.",
+          Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION),
   QUIT("After all files have been opened, appended and output, quit Jalview. In ‑‑headless mode this already happens.",
           Opt.UNARY),
 
@@ -176,13 +203,11 @@ public enum Arg
   // used by jalview.bin.Launcher to set memory settings. They are not used by
   // argparser but are here for Usage statement reasons.
   JVMMEMPC(
-          "Only available with standalone executable jar or jalview.bin.Launcher.\n"
-                  + "Limit maximum heap size (memory) to PERCENT% of total physical memory detected. This defaults to 90 if total physical memory can be detected.\n"
+          "Limit maximum heap size (memory) to PERCENT% of total physical memory detected. This defaults to 90 if total physical memory can be detected.\n"
                   + "The equals sign (\"=\") separator must be used with no spaces.",
           Opt.NOACTION, Opt.BOOTSTRAP, Opt.STRING),
   JVMMEMMAX(
-          "Only available with standalone executable jar or jalview.bin.Launcher.\n"
-                  + "Limit maximum heap size (memory) to MAXMEMORY. MAXMEMORY can be specified in bytes, kilobytes(k), megabytes(m), gigabytes(g) or if you're lucky enough, terabytes(t). This defaults to 32g if total physical memory can be detected, or to 8g if total physical memory cannot be detected.\n"
+          "Limit maximum heap size (memory) to MAXMEMORY. MAXMEMORY can be specified in bytes, kilobytes(k), megabytes(m), gigabytes(g) or if you're lucky enough, terabytes(t). This defaults to 32g if total physical memory can be detected, or to 8g if total physical memory cannot be detected.\n"
                   + "The equals sign (\"=\") separator must be used with no spaces.",
           Opt.NOACTION, Opt.BOOTSTRAP, Opt.STRING),
 
@@ -232,6 +257,9 @@ public enum Arg
     INPUT, // This Arg counts as an input for REQUIREINPUT
     REQUIREINPUT, // This Arg can only be applied via --all if there is an
                   // input (i.e. --open or --append)
+    OUTPUT, // This Arg provides an output filename. With Opt.ALLOWALL *.ext is
+            // shorthand for --all --output={basename}.ext
+    STORED, // This Arg resets and creates a new set of "opened" linkedIds
   }
 
   private final String[] argNames;
@@ -454,6 +482,11 @@ public enum Arg
         options.add("allows substitutions");
       }
 
+      if (a.hasOption(Opt.ALLOWALL))
+      {
+        options.add("can be applied to all linked arguments");
+      }
+
       if (a.hasOption(Opt.PRIVATE))
       {
         options.add("for internal use only");