Class CommandLine
java.lang.Object
aQute.lib.getopt.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAssign an option, must handle flags, parameters, and parameters that can happen multiple times.Execute a command in a target object with a set of options and arguments and returns help text if something fails.voidgenerateDocumentation(Object target, Appendable out) getCommands(Object target) Parse a class and return a list of command names<T extends Options>
TgetOptions(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.voidShow all commands in a targetvoidShow the full help for a given commandvoidProvide a help text.
-
Constructor Details
-
CommandLine
-
-
Method Details
-
execute
-
generateDocumentation
-
getOptions
public <T extends Options> T getOptions(Class<T> specification, List<String> arguments) throws Exception Parse the options in a command line and return an interface that provides the options from this command line. This will parse up to (and including) -- or an argument that does not start with -- Throws:
Exception
-
assignOptionValue
public 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.- Parameters:
options- The command line mapm- the selected method for this optionargs- the args inputlast- if this is the last in a multi single character option
-
help
-
help
-
help
-
getCommands
-
getResult
-
subCmd
-