Class HtmlCommandUsageGenerator
java.lang.Object
com.github.rvesse.airline.help.common.AbstractUsageGenerator
com.github.rvesse.airline.help.common.AbstractCommandUsageGenerator
com.github.rvesse.airline.help.html.HtmlCommandUsageGenerator
- All Implemented Interfaces:
CommandUsageGenerator
A usage generator that generates HTML documentation
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Default stylesheet (Bootstrap)protected static final String
Constant for a new line (using a<br>
)List of stylesheet URLsFields inherited from class com.github.rvesse.airline.help.common.AbstractUsageGenerator
DEFAULT_COLUMNS
-
Constructor Summary
ConstructorsConstructorDescriptionHtmlCommandUsageGenerator
(boolean includeHidden) HtmlCommandUsageGenerator
(boolean includeHidden, String... stylesheetUrls) HtmlCommandUsageGenerator
(String... stylesheetUrls) HtmlCommandUsageGenerator
(String stylesheetUrl, boolean includeHidden) HtmlCommandUsageGenerator
(Comparator<? super OptionMetadata> optionComparator, boolean includeHidden, String... stylesheetUrls) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
outputAdditionalCss
(Writer writer) Outputs additional CSS directlyprotected void
outputDescription
(Writer writer, String programName, String[] groupNames, CommandMetadata command) Outputs a documentation section with the name and description of the commandprotected void
outputHelpHint
(Writer writer, HelpHint hint) Outputs a help hintprotected void
outputHelpSection
(Writer writer, HelpSection section) Outputs a help sectionprotected void
outputHtmlHeader
(Writer writer) Outputs the HTML header for the pageprotected void
outputOptionRestriction
(Writer writer, OptionMetadata option, OptionRestriction restriction, HelpHint hint) Outputs a documentation section detailing an allowed value for an optionprotected <T> void
outputOptions
(Writer writer, List<OptionMetadata> options, ArgumentsMetadata arguments, ParserMetadata<T> parserConfig) Outputs a documentation section detailing the optionsprotected void
outputPageHeader
(Writer writer, String programName, String[] groupNames, CommandMetadata command) Outputs a page headerprotected void
outputStylesheets
(Writer writer) Outputs the style sheet declarationsprotected List
<OptionMetadata> outputSynopsis
(Writer writer, String programName, String[] groupNames, CommandMetadata command) Outputs a documentation section with a synopsis of the command<T> void
usage
(String programName, String[] groupNames, String commandName, CommandMetadata command, ParserMetadata<T> parserConfig, OutputStream output) Generate the help and output it to the streamMethods inherited from class com.github.rvesse.airline.help.common.AbstractCommandUsageGenerator
findHelpSections, sortExitCodes, usage, usage
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
-
Field Details
-
DEFAULT_STYLESHEET
Default stylesheet (Bootstrap)- See Also:
-
NEWLINE
Constant for a new line (using a<br>
)- See Also:
-
stylesheetUrls
List of stylesheet URLs
-
-
Constructor Details
-
HtmlCommandUsageGenerator
public HtmlCommandUsageGenerator() -
HtmlCommandUsageGenerator
public HtmlCommandUsageGenerator(boolean includeHidden) -
HtmlCommandUsageGenerator
-
HtmlCommandUsageGenerator
-
HtmlCommandUsageGenerator
-
HtmlCommandUsageGenerator
public HtmlCommandUsageGenerator(Comparator<? super OptionMetadata> optionComparator, boolean includeHidden, String... stylesheetUrls)
-
-
Method Details
-
usage
public <T> void usage(String programName, String[] groupNames, String commandName, CommandMetadata command, ParserMetadata<T> parserConfig, OutputStream output) throws IOException Description copied from interface:CommandUsageGenerator
Generate the help and output it to the stream- 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 helpoutput
- Stream to output to- Throws:
IOException
- Thrown if there is a problem generating usage output
-
outputOptions
protected <T> void outputOptions(Writer writer, List<OptionMetadata> options, ArgumentsMetadata arguments, ParserMetadata<T> parserConfig) throws IOException Outputs a documentation section detailing the options- Parameters:
writer
- Writeroptions
- Option meta-data- Throws:
IOException
-
outputOptionRestriction
protected void outputOptionRestriction(Writer writer, OptionMetadata option, OptionRestriction restriction, HelpHint hint) throws IOException Outputs a documentation section detailing an allowed value for an option- Parameters:
writer
- Writeroption
- Option meta-datarestriction
- Restrictionhint
- Help hint- Throws:
IOException
-
outputHelpSection
Outputs a help section- Parameters:
writer
- Writersection
- Help section- Throws:
IOException
-
outputHelpHint
Outputs a help hint- Parameters:
writer
- Writerhint
- Help hint- Throws:
IOException
-
outputSynopsis
protected List<OptionMetadata> outputSynopsis(Writer writer, String programName, String[] groupNames, CommandMetadata command) throws IOException Outputs a documentation section with a synopsis of the command- Parameters:
writer
- WriterprogramName
- Program namegroupNames
- Group name(s)command
- Command name- Returns:
- List of all the available options (Global, Group and Command)
- Throws:
IOException
-
outputDescription
protected void outputDescription(Writer writer, String programName, String[] groupNames, CommandMetadata command) throws IOException Outputs a documentation section with the name and description of the command- Parameters:
writer
- WriterprogramName
- Program namegroupNames
- Group name(s)command
- Command meta-data- Throws:
IOException
-
outputPageHeader
protected void outputPageHeader(Writer writer, String programName, String[] groupNames, CommandMetadata command) throws IOException Outputs a page header- Parameters:
writer
- WriterprogramName
- Program namegroupNames
- Group name(s)command
- Command meta-data- Throws:
IOException
-
outputHtmlHeader
Outputs the HTML header for the page- Parameters:
writer
- Writer- Throws:
IOException
-
outputAdditionalCss
Outputs additional CSS directly- Parameters:
writer
- Writer- Throws:
IOException
-
outputStylesheets
Outputs the style sheet declarations- Parameters:
writer
- Writer- Throws:
IOException
-