public class OptionHandler extends Object
OptionParsingCommand
to parse options and run the command.OptionParsingCommand
,
run(OptionSet)
Constructor and Description |
---|
OptionHandler()
Create a new
OptionHandler instance. |
OptionHandler(Function<String,String> argumentProcessor)
Create a new
OptionHandler instance with an argument processor. |
Modifier and Type | Method and Description |
---|---|
String |
getHelp() |
Collection<OptionHelp> |
getOptionsHelp() |
joptsimple.OptionParser |
getParser() |
joptsimple.OptionSpecBuilder |
option(List<String> aliases,
String description) |
joptsimple.OptionSpecBuilder |
option(String name,
String description) |
protected void |
options() |
protected ExitStatus |
run(joptsimple.OptionSet options)
Run the command using the specified parsed
OptionSet . |
ExitStatus |
run(String... args) |
public OptionHandler()
OptionHandler
instance.public OptionHandler(Function<String,String> argumentProcessor)
OptionHandler
instance with an argument processor.argumentProcessor
- strategy that can be used to manipulate arguments before
they are used.public joptsimple.OptionParser getParser()
protected void options()
public final ExitStatus run(String... args) throws Exception
Exception
protected ExitStatus run(joptsimple.OptionSet options) throws Exception
OptionSet
.options
- the parsed option setException
- in case of errorspublic String getHelp()
public Collection<OptionHelp> getOptionsHelp()