Class ManGlobalUsageGenerator<T>

All Implemented Interfaces:
GlobalUsageGenerator<T>
Direct Known Subclasses:
ManMultiPageGlobalUsageGenerator

public class ManGlobalUsageGenerator<T> extends AbstractGlobalUsageGenerator<T>

A global usage generator which generates Man pages in Troff format

  • Field Details

    • commandUsageGenerator

      protected final CommandUsageGenerator commandUsageGenerator
    • manSection

      protected final int manSection
    • helper

      protected final ManUsageHelper helper
  • Constructor Details

    • ManGlobalUsageGenerator

      public ManGlobalUsageGenerator()
    • ManGlobalUsageGenerator

      public ManGlobalUsageGenerator(int manSection)
    • ManGlobalUsageGenerator

      public ManGlobalUsageGenerator(int manSection, boolean includeHidden)
    • ManGlobalUsageGenerator

      protected ManGlobalUsageGenerator(int manSection, boolean includeHidden, CommandUsageGenerator commandUsageGenerator)
  • Method Details

    • createHelper

      protected ManUsageHelper createHelper(boolean includeHidden)
    • usage

      public void usage(GlobalMetadata<T> global, OutputStream output) throws IOException
      Description copied from interface: GlobalUsageGenerator
      Generate the help and output it to the stream
      Parameters:
      global - Global metadata
      output - Stream to output to
      Throws:
      IOException - Thrown if there is a problem generating usage output
    • outputGroupList

      protected void outputGroupList(TroffPrinter printer, GlobalMetadata<T> global) throws IOException
      Outputs a documentation section that lists the available groups and the commands they contain

      Used only when a CLI has command groups, if no groups are present then outputCommandList(TroffPrinter, GlobalMetadata) is used instead.

      Parameters:
      printer - Troff printer
      global - Global meta-data
      Throws:
      IOException - Thrown if there is a problem generating usage output
    • outputGroupCommandsList

      protected void outputGroupCommandsList(TroffPrinter printer, GlobalMetadata<T> global, List<CommandGroupMetadata> groups) throws IOException
      Throws:
      IOException
    • outputCommandList

      protected void outputCommandList(TroffPrinter printer, GlobalMetadata<T> global) throws IOException
      Outputs a documentation section that lists the available commands

      Used only when a CLI does not have command groups, if groups are present then outputGroupList(TroffPrinter, GlobalMetadata) is used instead.

      Parameters:
      printer - Troff Printer
      global - Global meta-data
      Throws:
      IOException - Thrown if there is a problem generating usage output
    • outputSynopsis

      protected void outputSynopsis(TroffPrinter printer, GlobalMetadata<T> global) throws IOException
      Outputs a documentation section with a synopsis of how to use the CLI
      Parameters:
      printer - Troff Printer
      global - Global meta-data
      Throws:
      IOException - Thrown if there is a problem generating usage output
    • outputTitle

      protected void outputTitle(GlobalMetadata<T> global, TroffPrinter printer) throws IOException
      Outputs the title section for the documentation
      Parameters:
      global - Global meta-data
      printer - Troff printer
      Throws:
      IOException - Thrown if there is a problem generating usage output
    • outputCommandUsages

      protected void outputCommandUsages(OutputStream output, TroffPrinter printer, GlobalMetadata<T> global) throws IOException
      Outputs the command usages for all groups
      Parameters:
      output - Output stream
      printer - Writer
      global - Global meta-data
      Throws:
      IOException - Thrown if there is a problem generating usage output
    • getCommandName

      protected String getCommandName(GlobalMetadata<T> global, String[] groupNames, CommandMetadata command)
      Gets the display name for a command
      Parameters:
      global - Global meta-data
      groupNames - Group name(s) (may be null)
      command - Command meta-data
      Returns:
      Display name for the command
    • outputGroupCommandUsages

      protected void outputGroupCommandUsages(OutputStream output, TroffPrinter printer, GlobalMetadata<T> global, List<CommandGroupMetadata> groups) throws IOException
      Outputs the command usages for the commands in the given group
      Parameters:
      output - Output
      printer - Writer
      global - Global Meta-data
      groups - Groups Meta-data
      Throws:
      IOException - Thrown if there is a problem generating usage output
    • outputDefaultGroupCommandUsages

      protected void outputDefaultGroupCommandUsages(OutputStream output, TroffPrinter printer, GlobalMetadata<T> global) throws IOException
      Outputs the command usages for the commands in the default group
      Parameters:
      output - Output
      printer - Writer
      global - Global meta-data
      Throws:
      IOException - Thrown if there is a problem generating usage output
    • toDescription

      protected String toDescription(OptionMetadata option)
      Converts an option to its description form
      Overrides:
      toDescription in class AbstractUsageGenerator