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
Fields Modifier and Type Field Description private java.util.Comparator<? super java.util.Map.Entry<java.lang.Integer,java.lang.String>>
exitCodeComparator
-
Fields inherited from class com.github.rvesse.airline.help.common.AbstractUsageGenerator
DEFAULT_COLUMNS
-
-
Constructor Summary
Constructors Constructor Description AbstractCommandUsageGenerator()
AbstractCommandUsageGenerator(boolean includeHidden)
AbstractCommandUsageGenerator(java.util.Comparator<? super HelpHint> hintComparator, java.util.Comparator<? super OptionMetadata> optionComparator, java.util.Comparator<? super java.util.Map.Entry<java.lang.Integer,java.lang.String>> exitCodeComparator, boolean includeHidden)
AbstractCommandUsageGenerator(java.util.Comparator<? super OptionMetadata> optionComparator)
AbstractCommandUsageGenerator(java.util.Comparator<? super OptionMetadata> optionComparator, boolean includeHidden)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
findHelpSections(CommandMetadata command, java.util.List<HelpSection> preSections, java.util.List<HelpSection> postSections)
Finds the help sectionsprotected java.util.List<java.util.Map.Entry<java.lang.Integer,java.lang.String>>
sortExitCodes(java.util.List<java.util.Map.Entry<java.lang.Integer,java.lang.String>> exitCodes)
Sorts the exit codes assuming a non-null comparator was provided at instantiation time<T> void
usage(CommandMetadata command, ParserMetadata<T> parserConfig, java.io.OutputStream output)
Generates the help output to the provided output stream<T> void
usage(java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName, CommandMetadata command, ParserMetadata<T> parserConfig)
Generate the help and output it on standard out-
Methods 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
-
-
-
-
Constructor Detail
-
AbstractCommandUsageGenerator
public AbstractCommandUsageGenerator()
-
AbstractCommandUsageGenerator
public AbstractCommandUsageGenerator(boolean includeHidden)
-
AbstractCommandUsageGenerator
public AbstractCommandUsageGenerator(java.util.Comparator<? super OptionMetadata> optionComparator)
-
AbstractCommandUsageGenerator
public AbstractCommandUsageGenerator(java.util.Comparator<? super OptionMetadata> optionComparator, boolean includeHidden)
-
AbstractCommandUsageGenerator
public AbstractCommandUsageGenerator(java.util.Comparator<? super HelpHint> hintComparator, java.util.Comparator<? super OptionMetadata> optionComparator, java.util.Comparator<? super java.util.Map.Entry<java.lang.Integer,java.lang.String>> exitCodeComparator, boolean includeHidden)
-
-
Method Detail
-
usage
public <T> void usage(CommandMetadata command, ParserMetadata<T> parserConfig, java.io.OutputStream output) throws java.io.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:
java.io.IOException
-
usage
public <T> void usage(java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName, CommandMetadata command, ParserMetadata<T> parserConfig) throws java.io.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:
java.io.IOException
- Thrown if there is a problem generating usage output
-
sortExitCodes
protected java.util.List<java.util.Map.Entry<java.lang.Integer,java.lang.String>> sortExitCodes(java.util.List<java.util.Map.Entry<java.lang.Integer,java.lang.String>> exitCodes)
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, java.util.List<HelpSection> preSections, java.util.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
-
-