Command Line Flags

Most Linux (and some Windows) programs accept command line flags. It is standard to demarcate command line flags with a dash. The Linux ls directory-listing program is an example: the -l flag tells ls that it should print an extended listing of the files in the current directory.

ls -l

Modeler also abides by the dash convention; each preference that a program accepts can be assigned a value via a command line flag preceded by a dash. A program invocation example is shown below.

op_vuorb -orb_name leo -sm_axis 6700.0 -moon_effects

Most preferences take a value argument: in the preceding example, the sm_axis preference is assigned the value 6700.0 and the orb_name preference is assigned the value "leo". On the other hand, the boolean moon_effects preference does not need a value argument; merely including it on the command line is equivalent to setting its value to TRUE.

The following table lists the command line syntax for each of the four basic preference types.

Table 10: Command Line Syntax for Basic Preference Types

Type Syntax Example
integer -><attr_name> <int_value> -size 345
double -><attr_name> <double_value> -mean_anomaly 214.6
string -><attr_name> <string_value> -orb_name statkeep
-site_name "QTH"
boolean -><attr_name>
-><attr_name> <boolean_value>
-verbose
-verbose OFF

where <boolean_value> is defined to be one of the following strings:

  • on/off
  • true/false
  • enabled/disabled

(Any combination of uppercase and lowercase letters is allowed for <boolean_value> strings—for example, ON, True, ENabled, etc.)

The following syntax considerations apply to preferences used as command line flags.

  • Strings that are one word (with no embedded spaces or tabs) can appear directly after the flag name. Strings consisting of multiple words must be delimited by double quotes.
  • Alphanumeric strings that contain a dash (such as flags being passed to another program) must be specified in one of the following ways:
    • Enclose the value in double quotes, with a space character before the dash. For example: -bind_flags " -g"
    • Change the dash to a caret (which will be converted back to a hyphen automatically). For example: -bind_flags ^g
  • Numeric strings beginning with a dash are always interpreted as negative numbers and can appear directly after the flag name.
  • Boolean flags have two forms:
    • A short form in which no value argument is supplied (the value TRUE is assumed).
    • A long form in which a boolean value argument is supplied.
  • List preferences use an extension of basic preference syntax. Instead of a single value argument following each preference name flag, there can be more than one value. An example of a string list preference being assigned via the command line appears below. In this case, the ef preference is assigned two strings: base_orb_defs and low_earth_defs.
	op_vuorb -ef base_orb_defs low_earth_defs

The command line flag mechanism for preference passing is useful for preferences that change on a run-to-run basis (for instance, the verbose preference); it is not very convenient for large numbers of preferences. For programs that require a large number of preferences to be passed, it is more efficient to pass most of the preferences via the environment file mechanism.