|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectds.ov2.util.Parse_commandline
public class Parse_commandline
Command line parsing. Invoke the options found on the command line
and print a usage information and exit the program if one of the
options -h, -help or --help was found or if one of
the options was used incorrectly.
| Field Summary | |
|---|---|
private String |
application_name
Short application name for the usage. |
private Option[] |
options
The options array. |
| Constructor Summary | |
|---|---|
Parse_commandline(Option[] options,
String application_name)
Construct an instance for parsing the command line. |
|
| Method Summary | |
|---|---|
void |
format_option_description()
Format option descriptions for the usage message to System.out. |
private String |
left_side(Option o)
Return the option and argument string. |
void |
parse(String[] args)
Parse a complete command line. |
private void |
usage()
Print the usage message to System.out. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final Option[] options
private final String application_name
| Constructor Detail |
|---|
public Parse_commandline(Option[] options,
String application_name)
options - the options to parseapplication_name - for the usage message| Method Detail |
|---|
private String left_side(Option o)
format_option_description().
o - option
format_option_description()public void format_option_description()
private void usage()
-h print help
-i n int argument n
The explanations on the right hand side are nicely lined up.
public void parse(String[] args)
Commandline
instance from the arguments args, matches against the
options and calls their Option.matched
method as appropriate.
If one of -h, -help, --help or an unknow option is
found or if one of the options is used inappropriately, a usage
information is printed and the program is exited.
args - the command line arguments as received in main
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||