|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectaQute.lib.getopt.CommandLine
public class CommandLine
Helps parsing command lines. This class takes target object, a primary command, and a list of arguments. It will then find the command in the target object. The method of this command must start with a "_" and take an parameter of Options type. Usually this is an interface that extends Options. The methods on this interface are options or flags (when they return boolean).
| Constructor Summary | |
|---|---|
CommandLine(Reporter reporter)
|
|
| Method Summary | ||
|---|---|---|
void |
assignOptionValue(Map<String,Object> options,
Method m,
List<String> args,
boolean last)
Assign an option, must handle flags, parameters, and parameters that can happen multiple times. |
|
String |
execute(Object target,
String cmd,
List<String> input)
Execute a command in a target object with a set of options and arguments and returns help text if something fails. |
|
void |
generateDocumentation(Object target,
Appendable out)
|
|
Map<String,Method> |
getCommands(Object target)
Parse a class and return a list of command names |
|
|
getOptions(Class<T> specification,
List<String> arguments)
Parse the options in a command line and return an interface that provides the options from this command line. |
|
Object |
getResult()
|
|
void |
help(Formatter f,
Object target)
Show all commands in a target |
|
void |
help(Formatter f,
Object target,
String cmd)
Show the full help for a given command |
|
void |
help(Formatter f,
Object target,
String cmd,
Class<? extends Options> specification)
Provide a help text. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CommandLine(Reporter reporter)
| Method Detail |
|---|
public String execute(Object target,
String cmd,
List<String> input)
throws Exception
Exception
public void generateDocumentation(Object target,
Appendable out)
public <T extends Options> T getOptions(Class<T> specification,
List<String> arguments)
throws Exception
Exception
public void assignOptionValue(Map<String,Object> options,
Method m,
List<String> args,
boolean last)
options - The command line mapargs - the args inputi - where we arem - the selected method for this optionlast - if this is the last in a multi single character option
public void help(Formatter f,
Object target,
String cmd,
Class<? extends Options> specification)
public void help(Formatter f,
Object target)
throws Exception
Exception
public void help(Formatter f,
Object target,
String cmd)
public Map<String,Method> getCommands(Object target)
target -
public Object getResult()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||