|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CommandLineProcessor
A lightweight command-line processing tool.
Nested Class Summary | |
---|---|
static interface |
CommandLineProcessor.Configurable
Interface for objects that can be configured with command-line arguments. |
Method Summary | |
---|---|
int |
consumeArguments(java.lang.String[] args,
int startPos)
Try to consume a the command-line argument at position i. |
void |
processArguments(java.lang.String[] args)
Loop thru the command-line arguments. |
boolean |
shouldTerminate()
Specifies whether the commandline processing should terminate. |
void |
usage()
Give usage() information. |
void |
usage(java.lang.String errorMessage)
Prints errorMessage and then calls usage(). |
Method Detail |
---|
void processArguments(java.lang.String[] args)
If function like -foo happens to return a non-null
CommandLineProcessor, that processor is invoked on the
arguments immediately after foo. This allows one
CommandLineProcessor to pass command-line options to a second
one. For instance, if x and y are CommandLineProcessors, x has
an method colorOpts() that returns y, and y has methods
background(String s) and foreground(String t) then the command
line sequence -colorOpts -background blue -foreground
red
would call the expected methods of y.
The optional "-config FILE" should cause a Properties object to be loaded from FILE, and the property/value pairs in the Properties object to be treated as if they were option/argument pairs. The order of lines in the property file may not be preserved, however, and duplicated keys will be ignored.
For instance, calling -config FILE for a FILE containing
would be the same as the command options
baz=
foo=bar
-foo bar -baz
or possibly -baz -foo bar
int consumeArguments(java.lang.String[] args, int startPos)
void usage(java.lang.String errorMessage)
void usage()
boolean shouldTerminate()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |