Class HtmlCommandUsageGenerator

All Implemented Interfaces:
CommandUsageGenerator

public class HtmlCommandUsageGenerator extends AbstractCommandUsageGenerator
A usage generator that generates HTML documentation
  • Field Details

    • DEFAULT_STYLESHEET

      public static final String DEFAULT_STYLESHEET
      Default stylesheet (Bootstrap)
      See Also:
    • NEWLINE

      protected static final String NEWLINE
      Constant for a new line (using a <br> )
      See Also:
    • stylesheetUrls

      protected final List<String> stylesheetUrls
      List of stylesheet URLs
  • Constructor Details

    • HtmlCommandUsageGenerator

      public HtmlCommandUsageGenerator()
    • HtmlCommandUsageGenerator

      public HtmlCommandUsageGenerator(boolean includeHidden)
    • HtmlCommandUsageGenerator

      public HtmlCommandUsageGenerator(String... stylesheetUrls)
    • HtmlCommandUsageGenerator

      public HtmlCommandUsageGenerator(boolean includeHidden, String... stylesheetUrls)
    • HtmlCommandUsageGenerator

      public HtmlCommandUsageGenerator(String stylesheetUrl, boolean includeHidden)
    • 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 Name
      groupNames - Group Name(s)
      commandName - Command Name
      command - Command Metadata
      parserConfig - Parser Configuration, if null is passed then the parser configuration is automatically determined based on the command class for which we are producing help
      output - 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 - Writer
      options - 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 - Writer
      option - Option meta-data
      restriction - Restriction
      hint - Help hint
      Throws:
      IOException
    • outputHelpSection

      protected void outputHelpSection(Writer writer, HelpSection section) throws IOException
      Outputs a help section
      Parameters:
      writer - Writer
      section - Help section
      Throws:
      IOException
    • outputHelpHint

      protected void outputHelpHint(Writer writer, HelpHint hint) throws IOException
      Outputs a help hint
      Parameters:
      writer - Writer
      hint - 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 - Writer
      programName - Program name
      groupNames - 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 - Writer
      programName - Program name
      groupNames - 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 - Writer
      programName - Program name
      groupNames - Group name(s)
      command - Command meta-data
      Throws:
      IOException
    • outputHtmlHeader

      protected void outputHtmlHeader(Writer writer) throws IOException
      Outputs the HTML header for the page
      Parameters:
      writer - Writer
      Throws:
      IOException
    • outputAdditionalCss

      protected void outputAdditionalCss(Writer writer) throws IOException
      Outputs additional CSS directly
      Parameters:
      writer - Writer
      Throws:
      IOException
    • outputStylesheets

      protected void outputStylesheets(Writer writer) throws IOException
      Outputs the style sheet declarations
      Parameters:
      writer - Writer
      Throws:
      IOException