Class ManCommandUsageGenerator

    • Field Detail

      • manSection

        private final int manSection
    • Constructor Detail

      • ManCommandUsageGenerator

        public ManCommandUsageGenerator()
      • ManCommandUsageGenerator

        public ManCommandUsageGenerator​(int manSection,
                                        boolean includeHidden)
        Creates a new man page usage generator
        Parameters:
        manSection - Man section to which this command belongs, use constants from ManSections
        includeHidden - Whether to include hidden items in the help output
    • Method Detail

      • createHelper

        protected ManUsageHelper createHelper​(boolean includeHidden)
      • usage

        public <T> void usage​(java.lang.String programName,
                              java.lang.String[] groupNames,
                              java.lang.String commandName,
                              CommandMetadata command,
                              ParserMetadata<T> parserConfig,
                              java.io.OutputStream output)
                       throws java.io.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:
        java.io.IOException - Thrown if there is a problem generating usage output
      • outputOptions

        protected <T> void outputOptions​(TroffPrinter printer,
                                         CommandMetadata command,
                                         java.util.List<OptionMetadata> options,
                                         ParserMetadata<T> parserConfig)
                                  throws java.io.IOException
        Outputs a documentation section detailing the options and their usages
        Type Parameters:
        T - Command type
        Parameters:
        printer - Troff Printer
        command - Command
        options - Option meta-data
        parserConfig - Parser configuration
        Throws:
        java.io.IOException - Thrown if there is a problem generating usage output
      • outputSynopsis

        protected java.util.List<OptionMetadata> outputSynopsis​(TroffPrinter printer,
                                                                java.lang.String programName,
                                                                java.lang.String[] groupNames,
                                                                java.lang.String commandName,
                                                                CommandMetadata command)
                                                         throws java.io.IOException
        Outputs a synopsis section for the documentation showing how to use a command
        Parameters:
        printer - Troff printer
        programName - Program name
        groupNames - Group name(s)
        commandName - Command name
        command - Command
        Returns:
        List of all the available options (global, group and command)
        Throws:
        java.io.IOException - Thrown if there is a problem generating usage output
      • outputTitle

        protected void outputTitle​(TroffPrinter printer,
                                   java.lang.String programName,
                                   java.lang.String[] groupNames,
                                   java.lang.String commandName,
                                   CommandMetadata command)
                            throws java.io.IOException
        Outputs a title section for the document
        Parameters:
        printer - Troff Printer
        programName - Program name
        groupNames - Group name(s)
        commandName - Command name
        command - Command meta-data
        Throws:
        java.io.IOException - Thrown if there is a problem generating usage output
      • getFullCommandName

        protected java.lang.String getFullCommandName​(java.lang.String programName,
                                                      java.lang.String[] groupNames,
                                                      java.lang.String commandName)
                                               throws java.io.IOException
        Gets the full command name in man page syntax
        Parameters:
        programName - Program name
        groupNames - Group name(s)
        commandName - Command name
        Returns:
        Full command name
        Throws:
        java.io.IOException - Thrown if there is a problem generating usage output