SubCommandDef - The sub-command interface.public class SubCommandSet<SubCommandDef> extends BaseArgument
ArgumentException if
not valid), so the sub-command must be added last.| Constructor and Description |
|---|
SubCommandSet(String name,
String usage,
Consumer<SubCommandDef> consumer)
Create a sub-command set.
|
SubCommandSet(String name,
String usage,
Consumer<SubCommandDef> consumer,
ArgumentOptions options)
Create an optional sub-command set.
|
SubCommandSet(String name,
String usage,
Consumer<SubCommandDef> consumer,
String defaultValue)
Create an optional sub-command set.
|
SubCommandSet(String name,
String usage,
Consumer<SubCommandDef> consumer,
String defaultValue,
boolean required,
ArgumentOptions options)
Create an optional sub-command set.
|
| Modifier and Type | Method and Description |
|---|---|
SubCommandSet |
add(SubCommand<SubCommandDef> subCommand)
Add a sub-command to the sub-command-set.
|
SubCommandSet |
addAll(SubCommand<SubCommandDef>... subCommands)
Add a set of sub-commands to the sub-command-set.
|
int |
apply(ArgumentList args)
Try to apply to the argument.
|
String |
getPrefix()
Prefix part of the usage usage message.
|
String |
getSingleLineUsage()
Get the argument's single line usage string.
|
String |
getSingleLineUsage(String name)
Get the single line usage string for a given sub-command.
|
void |
printUsage(OutputStream out)
Print the sub-command list.
|
void |
printUsage(OutputStream out,
boolean showHidden)
Print the sub-command list.
|
void |
printUsage(OutputStream out,
String name)
Print the option usage list for the command.
|
void |
printUsage(OutputStream out,
String name,
boolean showHidden)
Print the option usage list for the command.
|
void |
printUsage(PrintWriter out)
Print the sub-command list.
|
void |
printUsage(PrintWriter writer,
boolean showHidden)
Print the sub-command list.
|
void |
printUsage(PrintWriter writer,
String name)
Print the option usage list for the command.
|
void |
printUsage(PrintWriter writer,
String name,
boolean showHidden)
Print the option usage list.
|
void |
validate()
Called on all the arguments after the parsing is done to validate
if all requirements have been passed.
|
getDefaultValue, getName, getUsage, isHidden, isRepeated, isRequiredpublic SubCommandSet(String name, String usage, Consumer<SubCommandDef> consumer)
name - The name of the sub-command.usage - The usage description.consumer - The sub-command consumer.public SubCommandSet(String name, String usage, Consumer<SubCommandDef> consumer, ArgumentOptions options)
name - The name of the sub-command.usage - The usage description.consumer - The sub-command consumer.options - Extra argument options.public SubCommandSet(String name, String usage, Consumer<SubCommandDef> consumer, String defaultValue)
name - The name of the sub-command.usage - The usage description.consumer - The sub-command consumer.defaultValue - The default sub-command.public SubCommandSet(String name, String usage, Consumer<SubCommandDef> consumer, String defaultValue, boolean required, ArgumentOptions options)
name - The name of the sub-command.usage - The usage description.consumer - The sub-command consumer.defaultValue - The default sub-command.required - If the sub-command is required.options - Extra argument options.public SubCommandSet add(SubCommand<SubCommandDef> subCommand)
subCommand - The sub-command to add.@SafeVarargs public final SubCommandSet addAll(SubCommand<SubCommandDef>... subCommands)
subCommands - The sub-commands to add.public void printUsage(OutputStream out)
out - The output stream.public void printUsage(PrintWriter out)
out - The output stream.public void printUsage(OutputStream out, boolean showHidden)
out - The output stream.showHidden - If hidden sub-commands should be printed.public void printUsage(PrintWriter writer, boolean showHidden)
writer - The output printer.showHidden - Whether to show hidden options.public void printUsage(OutputStream out, String name)
out - The output stream.name - The sub-command to print help for.public void printUsage(OutputStream out, String name, boolean showHidden)
out - The output stream.name - The sub-command to print help for.showHidden - If hidden sub-commands should be shown.public void printUsage(PrintWriter writer, String name)
writer - The output printer.name - The sub-command to print help for.public String getSingleLineUsage(String name)
name - The sub-command to print help for.public void printUsage(PrintWriter writer, String name, boolean showHidden)
writer - The output printer.name - The sub-command to print help for.showHidden - Whether to show hidden options.public String getSingleLineUsage()
BaseArgumentgetSingleLineUsage in class BaseArgumentpublic String getPrefix()
BaseArgumentgetPrefix in class BaseArgumentpublic void validate()
throws ArgumentException
BaseArgumentArgumentException if is did not validate with the appropriate
error message.validate in class BaseArgumentArgumentExceptionpublic int apply(ArgumentList args)
BaseArgumentapply in class BaseArgumentargs - The argument list.Copyright © 2017. All rights reserved.