Class AbstractCommandUsageGenerator
java.lang.Object
com.github.rvesse.airline.help.common.AbstractUsageGenerator
com.github.rvesse.airline.help.common.AbstractCommandUsageGenerator
- All Implemented Interfaces:
CommandUsageGenerator
- Direct Known Subclasses:
AbstractPrintedCommandUsageGenerator, HtmlCommandUsageGenerator, ManCommandUsageGenerator
public abstract class AbstractCommandUsageGenerator
extends AbstractUsageGenerator
implements CommandUsageGenerator
Abstract command usage generator
-
Field Summary
FieldsFields inherited from class AbstractUsageGenerator
DEFAULT_COLUMNS -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCommandUsageGenerator(boolean includeHidden) AbstractCommandUsageGenerator(Comparator<? super HelpHint> hintComparator, Comparator<? super OptionMetadata> optionComparator, Comparator<? super Map.Entry<Integer, String>> exitCodeComparator, boolean includeHidden) AbstractCommandUsageGenerator(Comparator<? super OptionMetadata> optionComparator) AbstractCommandUsageGenerator(Comparator<? super OptionMetadata> optionComparator, boolean includeHidden) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfindHelpSections(CommandMetadata command, List<HelpSection> preSections, List<HelpSection> postSections) Finds the help sectionssortExitCodes(List<Map.Entry<Integer, String>> exitCodes) Sorts the exit codes assuming a non-null comparator was provided at instantiation time<T> voidusage(CommandMetadata command, ParserMetadata<T> parserConfig, OutputStream output) Generates the help output to the provided output stream<T> voidusage(String programName, String[] groupNames, String commandName, CommandMetadata command, ParserMetadata<T> parserConfig) Generate the help and output it on standard outMethods inherited from class AbstractUsageGenerator
getCommandComparator, getOptionComparator, htmlize, includeHidden, sortArgumentsRestrictions, sortCommands, sortOptionRestrictions, sortOptions, toDefaultCommand, toDescription, toDescription, toSynopsisUsage, toUsage, toUsageMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CommandUsageGenerator
usage
-
Field Details
-
exitCodeComparator
-
-
Constructor Details
-
AbstractCommandUsageGenerator
public AbstractCommandUsageGenerator() -
AbstractCommandUsageGenerator
public AbstractCommandUsageGenerator(boolean includeHidden) -
AbstractCommandUsageGenerator
-
AbstractCommandUsageGenerator
public AbstractCommandUsageGenerator(Comparator<? super OptionMetadata> optionComparator, boolean includeHidden) -
AbstractCommandUsageGenerator
public AbstractCommandUsageGenerator(Comparator<? super HelpHint> hintComparator, Comparator<? super OptionMetadata> optionComparator, Comparator<? super Map.Entry<Integer, String>> exitCodeComparator, boolean includeHidden)
-
-
Method Details
-
usage
public <T> void usage(CommandMetadata command, ParserMetadata<T> parserConfig, OutputStream output) throws IOException Description copied from interface:CommandUsageGeneratorGenerates the help output to the provided output stream- Specified by:
usagein interfaceCommandUsageGenerator- Parameters:
command- Command MetadataparserConfig- Parser configurationoutput- Output Stream- Throws:
IOException
-
usage
public <T> void usage(String programName, String[] groupNames, String commandName, CommandMetadata command, ParserMetadata<T> parserConfig) throws IOException Description copied from interface:CommandUsageGeneratorGenerate the help and output it on standard out- Specified by:
usagein interfaceCommandUsageGenerator- Type Parameters:
T- Command type- Parameters:
programName- Program NamegroupNames- Group Name(s)commandName- Command Namecommand- Command MetadataparserConfig- Parser configuration, ifnullis passed then the parser configuration is automatically determined based on the command class for which we are producing help- Throws:
IOException- Thrown if there is a problem generating usage output
-
sortExitCodes
-
findHelpSections
protected void findHelpSections(CommandMetadata command, List<HelpSection> preSections, List<HelpSection> postSections) Finds the help sections- Parameters:
command- Command meta-datapreSections- Sections that should be placed before base contentpostSections- Sections that should be placed after base content
-