Module com.github.rvesse.airline
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 com.github.rvesse.airline.help.common.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 void
findHelpSections
(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> void
usage
(CommandMetadata command, ParserMetadata<T> parserConfig, OutputStream output) Generates the help output to the provided output stream<T> void
usage
(String programName, String[] groupNames, String commandName, CommandMetadata command, ParserMetadata<T> parserConfig) Generate the help and output it on standard outMethods inherited from class com.github.rvesse.airline.help.common.AbstractUsageGenerator
getCommandComparator, getOptionComparator, htmlize, includeHidden, sortArgumentsRestrictions, sortCommands, sortOptionRestrictions, sortOptions, toDefaultCommand, toDescription, toDescription, toSynopsisUsage, toUsage, toUsage
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.github.rvesse.airline.help.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:CommandUsageGenerator
Generates the help output to the provided output stream- Specified by:
usage
in 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:CommandUsageGenerator
Generate the help and output it on standard out- Specified by:
usage
in interfaceCommandUsageGenerator
- Type Parameters:
T
- Command type- Parameters:
programName
- Program NamegroupNames
- Group Name(s)commandName
- Command Namecommand
- Command MetadataparserConfig
- Parser configuration, ifnull
is 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
Sorts the exit codes assuming a non-null comparator was provided at instantiation time- Parameters:
exitCodes
- Exit codes- Returns:
- Sorted exit codes
-
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
-