|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgnu.classpath.tools.getopt.Parser
public class Parser
An instance of this class is used to parse command-line options. It does "GNU style" argument recognition and also automatically handles "--help" and "--version" processing. It can also be put in "long option only" mode. In this mode long options are recognized with a single dash (as well as a double dash) and strings of options like "-abc" are never parsed as a collection of short options.
| Field Summary | |
|---|---|
static int |
MAX_LINE_LENGTH
The maximum right column position. |
| Constructor Summary | |
|---|---|
Parser(String programName,
String versionString)
Create a new parser. |
|
Parser(String programName,
String versionString,
boolean longOnly)
Create a new parser. |
|
| Method Summary | |
|---|---|
void |
add(Option opt)
Add an option to this parser. |
void |
add(OptionGroup group)
Add an option group to this parser. |
String[] |
parse(String[] inArgs)
Parse a command line. |
void |
parse(String[] inArgs,
FileArgumentCallback files)
Parse a command line. |
void |
printHelp()
|
void |
setFooter(String footerText)
Set the footer text that is printed by --help. |
void |
setHeader(String headerText)
Set the header text that is printed by --help. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_LINE_LENGTH
| Constructor Detail |
|---|
public Parser(String programName,
String versionString)
programName - the name of the programversionString - the program's version information
public Parser(String programName,
String versionString,
boolean longOnly)
programName - the name of the programversionString - the program's version informationlongOnly - true if the parser should work in long-option-only mode| Method Detail |
|---|
public void setHeader(String headerText)
headerText - the header textpublic void setFooter(String footerText)
footerText - the footer textpublic void add(Option opt)
opt - the optionpublic void add(OptionGroup group)
group - the option grouppublic void printHelp()
public void parse(String[] inArgs,
FileArgumentCallback files)
inArgs - the command-line argumentsfiles - the file argument callbackpublic String[] parse(String[] inArgs)
inArgs - the command-line arguments
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||