There are three stages to command line processing. They are the definition, parsing and interrogation stages. The following sections will discuss each of these stages in turn, and discuss how to implement them with CLI.
Each command line must define the set of options that will be used to define the interface to the application.
CLI uses the
class, as a container for
instances. There are two ways to create
Options in CLI. One of them is via the constructors,
the other way is via the factory methods defined in
The Usage Scenarios
examples how to create an
Options object and also
provides some real world examples.
The result of the definition stage is an
The parsing stage is where the text passed into the application via the command line is processed. The text is processed according to the rules defined by the parser implementation.
The result of the parsing stage is a
The interrogation stage is where the application querys the
CommandLine to decide what execution branch to
take depending on boolean options and uses the option values
to provide the application data.
This stage is implemented in the user code. The accessor methods
CommandLine provide the interrogation capability
to the user code.
The result of the interrogation stage is that the user code
is fully informed of all the text that was supplied on the command
line and processed according to the parser and