CommandLineParser
interface can parse a String array according to the {@link Options} specifiedand return a {@link CommandLine}.
@author John Keyes (john at integralsource.com)
@version $Revision: 680644 $, $Date: 2008-07-29 01:13:48 -0700 (Tue, 29 Jul 2008) $
The current version supports string and integer options.
Support is not included for options which take a list of values. @author Lane O.B. Schwartz @version $LastChangedDate: 2009-05-22 23:31:12 -0500 (Fri, 22 May 2009) $
CommandLineParser
interface can parse a String array according to the {@link Options} specifiedand return a {@link CommandLine}.
@author John Keyes (john at integralsource.com)
cruisecontrol -configfile cruisecontrol.xml -port 9000
zip -r project.zip project/
jar -tvf mytar.tarThe parsing rules are:
Responsibilities | Collaborations |
---|---|
Accept a command line specification. | |
Parse a command line into properties, validating it against its specification. | |
Report all errors between a command line and its specification. | |
Provide a formatted usage string for a command line. | |
Provide a formatted options in force string for a command line. | |
Allow errors on unknowns behaviour to be turned on or off. |
cruisecontrol -configfile cruisecontrol.xml -port 9000
zip -r project.zip project/
jar -tvf mytar.tarThe parsing rules are:
Responsibilities | Collaborations |
---|---|
Accept a command line specification. | |
Parse a command line into properties, validating it against its specification. | |
Report all errors between a command line and its specification. | |
Provide a formatted usage string for a command line. | |
Provide a formatted options in force string for a command line. | |
Allow errors on unknowns behaviour to be turned on or off. |
The parser can only handle parameters that take 0 or 1 arguments. That is, you can parse command lines like
doit -f -i file1 -o file2 --dir file3 /h file4 file5 file6
The syntax of parameters is left to the user, no common prefix is assumed or enforced. Parameter names can be arbitrarily long. You can define aliases for parameters: -h
, /H
and --help
can all mean the same parameter if so configured.
A command-line parser which supports a command/sub-command style command-line interface. Supports the following syntax:
<option>* (<sub-command> <sub-command-option>*)
A command-line parser which supports a command/subcommand style command-line interface. Supports the following syntax:
<option>* (<subcommand> <subcommand-option>*)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|