Rainbow - Command Line

From Okapi Framework
Jump to navigation Jump to search

When starting Rainbow has different behaviors depending on the arguments it has when starting:

  • If Rainbow is started with just one argument: it starts in normal mode and takes the argument as a project file to be loaded.
  • If Rainbow is started with more than one argument: it starts in command-line mode and interprets the arguments as described in the table below.

When running in batch mode, the log is saved into a file named rainbowBatchLog.txt in the home directory of the user.

Note that you can also use Tikal to execute various function from a command line.

The arguments of the command-line can be the following:

<inputFile>[ -fc <filterConfiguration>] Sets the input file, and optionally sets the filter configuration to assign to it. You can specify an absolute or a local filename. The input file root is reset to the folder of the given input file. If a project was loaded, all input files in that projects are removed and the input file root reset.

If you specify several input files (and their filter configurations) the first one will be assigned to the Input List 1, the second to the Input List 2, etc.

If the filter configuration is not specified in the command line, the default filter (if one can be found) is used. Input files must be specified prior to an output location being specified (via -o), and the -fc option must always follow an input file.

-p <projectFilename> Loads an existing project file <projectFilename>.
-x <Id> Executes the utility or the predefined pipeline with the ID <Id>. This is done after all arguments of the command line have been processed.
-pln <pipelineFilename> Loads and execute the specified pipeline stored in <pipelineFilename>. A pipeline file can be created by selecting Utilities -> Edit / Execute Pipeline from the menu bar, adding steps by clicking Add Step... button, and clicking the Save button.
-se <encoding> Sets the default source encoding to <encoding>.
-te <encoding> Sets the default target encoding to <encoding>.
-sl <langCode> Sets the source language using <langCode>.
-tl <langCode> Sets the target language using <langCode>.
-opt <optionFilename> Sets the options file to use for the utility to execute. Use the -np flag to be prompted or not to modify the options when the command line is executed. The options file must be for the utility defined with -x. Note that option file are only for utilities, not predefined pipelines. If a non-default behavior of a predefined configuration is desired, define your own pipeline and then use -pln <pipelineFilename>.
-log <logFile> Sets the path to the log file. If not specified {user.home}/rainbowBatchLog.txt is used.
-np No prompt for utility's options.
-o <outputFile> Sets the output file. If this option is not used and an input file is specified, the output file path and name is build based on the output options of the project (loaded or default). If this option is specified before an input file is provided, an error will be reported in the log.
-pd <directory> Sets the parameters directory (the location where the filter parameters files are stored). You can use . (dot) to specify the current directory. By default, if not project is loaded, the default parameters directory is the user home directory.
-ir <directory> Sets the input root directory for the first input list. You can use . (dot) to specify the current directory. This value is also used to set the ${inputRootDir} variable that can be used in some path parameters.
-rd <directory> Sets the root directory. You can use . (dot) to specify the current directory. This value is also used to set the ${rootDir} variable that can be used in some path parameters.
-? or -h Opens this help page.


Here are some example of command lines in Windows.

C:\>rainbow.exe -x TextRewriting -sl EN -tl FR myInput.xlf -o myOutput.xlf

The command-line above executes the Text Rewriting predefined pipeline with the source language set to EN and the target language set to FR. The input document is the XLIFF file myInput.xlf, and the modified file is saved as myOutput.xlf.

C:\>rainbow.exe -x TranslationComparison -sl EN -tl FR -pd . myHumanTrans.xlf myMachineTrans.txt -fc okf_regex@myText

The command-line above executes the Translation Comparison predefined pipeline with the source language set to EN and the target language set to FR. The current folder (.) is specified as the parameters directory. The input file myHumanTrans.xlf is the input document for the Input List 1, and the default XLIFF filter configuration assigned to it. The input file myMachineTrans.txt is the input document for the Input List 2, and the custom filter parameters okf_regex@myText.fprm is associated with it. No utility options are specified, so the use will be prompted to set the options.

C:\>rainbow.exe -h

The command-line above opens this help page.


On macOS, go to /Applications, ~/Applications, or wherever you installed Okapi. For example:

Applications $ Rainbow.app/Contents/MacOS/rainbow.sh -h