Next: , Previous: , Up: Genparse File Syntax   [Contents][Index]

4.2 Parameter Definitions

Each command line parameter must be defined in the form

short_names[*|!] [/ long_name[*|!][=opt_name]] type [ options ]

A short_name is a single letter (small or capital) or a single digit. long_name is a longer (more descriptive) option name. On the command line a short name will be preceded by a single dash (e.g. -a) and a long version will be preceded by two dashes (e.g. --all). If a long parameter name is not necessary, you may specify only the short one (and the slash need not appear). In order to specify a parameter that only has a long name set short_names to NONE. It is possible to have multiple short options, so for example setting short_name to ’aA’ and long_name to ’all’ would allow to specify the command line switch as -a or -A or --all, all of them doing the same thing. long options can be followed by a descriptive designation (See opt_name.).

A * after short_name or long_name makes the argument optional. This can be specified for short and long options separately.

A ! after short_name or long_name makes the option boolean. This allows one to combine a boolean short option with a long option with an optional or mandatory argument or to combine a boolean long option with a short option with an optional or mandatory argument. A ! doesn’t make sense if the option’s type is flag. Examples:

o* / oparam*	string		"Both short and long option have an optional"
				"argument"
p* / pparam	string		"Short option has an optional argument,"
				"long option requires an argument."
q / qparam*	string		"Short option reqires an argument,"
				"long option has an optional argument."
P* / Pparam!	string		"Short option has an optional argument,"
				"long option none."
Q!/ Qparam*	string		"Short option has no argument, long option has an"
				"optional argument."

type must be one of int float char string or flag. The first four should be self-explanatory. The last is a "switch" option that takes no arguments. For C output and if --gnulib (See gnulib.) is set on the command line additionally the following types are allowed: long (for long int), ulong (for unsigned long int), intmax (for intmax_t, defined in Gnulib), uintmax (for uintmax_t), double.

The following four options are supported. They may appear in any order and except for descriptions only one of each field may be defined per option.


Next: , Previous: , Up: Genparse File Syntax   [Contents][Index]