initDefault()

Initializes a variable defined with the Getopt type.

Syntax

Getopt.initDefault(
   options GetoptOptions
   )
  1. options is a GetoptOptions array that holds the definition of the command line options.

Usage

This is a method for the Getopt type, used to initialize the variable of this type, using the current program name (arg_val(0)) and where the command line argument starting index is 1 (copyArguments(1)).

A variable of the type Getopt must be defined, as well as a GetoptOptions dynamic array containing the definitions of the command line options for the current program.

After initializing the Getopt record, use the getopt() method to parse and validate command line options.

Example

IMPORT FGL getopt

MAIN
    DEFINE g getopt.Getopt
    DEFINE _options getopt.GetoptOptions = [ ... ]

    CALL g.initDefault(_options)
    WHILE g.getopt() == getopt.SUCCESS
        ...
    END WHILE

END MAIN