Command Line: argument files

Command Line: introduction
Command Line: basic usage
Command Line: advanced usage
Command Line: argument files
Command Line: reference

Argument files

If you want to save a set of arguments to reuse, you can save them in a text file, say argfile.txt, and read them into Jalview with

  jalview --argfile=argfile.txt

The argument file has one argument and value per line, still using the double-dash ('--') before the argument name, and separating the argument and value with an equals sign ('=').
Because the argument file is read by the application and not read by the shell, you do not need to escape any values -- all spaces will be read as part of the value until the end of the line.
You can add comments to a line by starting the line with an hash (octothorpe, pound-sign '#').
File argfile.txt
# let's see what's happening

Because ‑‑argfiles takes a filename argument, and multiple ‑‑argfiles can be read on the command line, you can also use file globs to specify multiple ‑‑argfile values. If you produce an argument file for each set of alignment files that you wish to associate then you can act on all of them with, e.g.

  jalview --argfile=*/argfile.txt --headless

You can even read argument files from within argument files, e.g.

  jalview --argfile=argfile*.txt --headless
File argfile1.txt
File myfavouriteformattingargfile.txt
File mysecondfavouriteimageargfile.txt

If an argument file that has already been read is found in a firther argument file, then Jalview will exit with a warning. This is to avoid loops of argument files.

Only argument files

When you use an ‑‑argfile argument, all other non-initialising arguments on the command line will be ignored. Only the initialising arguments and any and all ‑‑argfiles arguments on the command line will be used. You can also set initialising arguments in argument files.

Even more substitutions

When adding values that can use substitutions within argument files, there are two additional substitutions that can be made:
{argfilebasename} - replaced with the base of the filename of the argument file (i.e. without directory path or file extension).
{argfiledirname} - replaced with the path to the filename of the argument file.

Another substitution you can make in argument files is the {n} substitution. Combined with an -npp increment at the start (or end) of the argument file gives the potential to reuse an argument files in the same command but referring to different files, e.g.
File alignment.argfile

  jalview --argfile alignment.argfile --argfile alignment.argfile --headless
would be processed the same as
  jalview --open=alignment-0.fa --wrap --output=alignment-0.stk --close --open=alignment-1.fa --wrap --output=alignment-1.stk --close --headless

Command Line: reference