Introducing Apache Commons CLIThere 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. The Definition StageEach command line must define the set of options that will be used to define the interface to the application.
CLI uses the
Options class, as a container for
Option instances. There are two ways to create
The Usage Scenarios document provides
examples how to create an
The result of the definition stage is an The Parsing StageThe 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
The result of the parsing stage is a The Interrogation Stage
The interrogation stage is where the application queries the
This stage is implemented in the user code. The accessor methods
on
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 |