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 Details

  • Constructor Details

    • AbstractCommandUsageGenerator

      public AbstractCommandUsageGenerator()
    • AbstractCommandUsageGenerator

      public AbstractCommandUsageGenerator(boolean includeHidden)
    • AbstractCommandUsageGenerator

      public AbstractCommandUsageGenerator(Comparator<? super OptionMetadata> optionComparator)
    • 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 interface CommandUsageGenerator
      Parameters:
      command - Command Metadata
      parserConfig - Parser configuration
      output - 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 interface CommandUsageGenerator
      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
      Throws:
      IOException - Thrown if there is a problem generating usage output
    • sortExitCodes

      protected List<Map.Entry<Integer,String>> sortExitCodes(List<Map.Entry<Integer,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, List<HelpSection> preSections, List<HelpSection> postSections)
      Finds the help sections
      Parameters:
      command - Command meta-data
      preSections - Sections that should be placed before base content
      postSections - Sections that should be placed after base content