Table of Contents
Command Line Parser is a separate library providing a simple Unix-style command line parsing.
Command line is what you write for launching an application, i.e. name of the desired executable file followed by directives that specify how the application should behave.
This library supports the following form of directives:
application_name <switches section> <other parameters section> |
Switches section consists of one or more switch sequences, where switch sequence means either a simple switch - a dash followed by a letter (-m, for example), or a parameter switch - simple switch followed by parameter, not neccessarily separated with blanks (i.e. -f <filename> or -ffilename, which has the same meaning). Moreover, switches may be grouped together. For instance, -g -h -i switches section has the same semantics as -ghi, where both g and h must be a non-parameter switches. i can be a non-parameter or parameter switch, in which case it should be followed by its parameter (-ghi parameter or even -ghiparameter).
Parameter section can be terminated in two ways:
by a sequence not beginning of - that isn't a parameter of some parameter switch.
by the -- sequence.
Other parameters section is a list of arbitrary words that are passed 'as they are' to the program (with one exception - if there is some string enclosed into quotes, the quotes are removed before passing it to the program).