Class AbstractHelpFormatter

    • Method Detail

      • getComparator

        protected java.util.Comparator<OptiongetComparator()
        Gets the comparator for sorting options.
        Returns:
        The comparator for sorting options.
      • getOptionGroupSeparator

        protected java.lang.String getOptionGroupSeparator()
        Gets the option group separator.
        Returns:
        The option group separator.
      • getSyntaxPrefix

        public final java.lang.String getSyntaxPrefix()
        Gets the currently set syntax prefix.
        Returns:
        The currently set syntax prefix.
      • printHelp

        public void printHelp​(java.lang.String cmdLineSyntax,
                              java.lang.String header,
                              java.lang.Iterable<Option> options,
                              java.lang.String footer,
                              boolean autoUsage)
                       throws java.io.IOException
        Prints the help for a collection of Options with the specified command line syntax.
        Parameters:
        cmdLineSyntax - the syntax for this application
        header - the banner to display at the beginning of the help
        options - the collection of Option objects to print.
        footer - the banner to display at the end of the help
        autoUsage - whether to print an automatically generated usage statement
        Throws:
        java.io.IOException - If the output could not be written to the HelpAppendable
      • printHelp

        public final void printHelp​(java.lang.String cmdLineSyntax,
                                    java.lang.String header,
                                    Options options,
                                    java.lang.String footer,
                                    boolean autoUsage)
                             throws java.io.IOException
        Prints the help for Options with the specified command line syntax.
        Parameters:
        cmdLineSyntax - the syntax for this application
        header - the banner to display at the beginning of the help
        options - the Options to print
        footer - the banner to display at the end of the help
        autoUsage - whether to print an automatically generated usage statement
        Throws:
        java.io.IOException - If the output could not be written to the HelpAppendable
      • printOptions

        public final void printOptions​(java.lang.Iterable<Option> options)
                                throws java.io.IOException
        Prints the option table for a collection of Option objects to the HelpAppendable.
        Parameters:
        options - the collection of Option objects to print in the table.
        Throws:
        java.io.IOException - If the output could not be written to the HelpAppendable
      • printOptions

        public final void printOptions​(Options options)
                                throws java.io.IOException
        Prints the option table for the specified Options to the HelpAppendable.
        Parameters:
        options - the Options to print in the table.
        Throws:
        java.io.IOException - If the output could not be written to the HelpAppendable
      • setSyntaxPrefix

        public final void setSyntaxPrefix​(java.lang.String prefix)
        Sets the syntax prefix. This is the phrase that is printed before the syntax line.
        Parameters:
        prefix - the new value for the syntax prefix.
      • sort

        public java.util.List<Optionsort​(java.lang.Iterable<Option> options)
        Creates a new list of options ordered by the comparator.
        Parameters:
        options - the Options to sort.
        Returns:
        a new list of options ordered by the comparator.
      • sort

        public java.util.List<Optionsort​(Options options)
        Creates a new list of options ordered by the comparator.
        Parameters:
        options - the Options to sort.
        Returns:
        a new list of options ordered by the comparator.
      • toArgName

        public final java.lang.String toArgName​(java.lang.String argName)
        Formats the argName as an argument a defined in the enclosed OptionFormatter.Builder
        Parameters:
        argName - the string to format as an argument.
        Returns:
        the argName formatted as an argument.
      • toSyntaxOptions

        public java.lang.String toSyntaxOptions​(java.lang.Iterable<Option> options)
        Return the string representation of the options as used in the syntax display.
        Parameters:
        options - The collection of Option instances to create the string representation for.
        Returns:
        the string representation of the options as used in the syntax display.
      • toSyntaxOptions

        protected java.lang.String toSyntaxOptions​(java.lang.Iterable<Option> options,
                                                   java.util.function.Function<Option,​OptionGroup> lookup)
        Return the string representation of the options as used in the syntax display.
        Parameters:
        options - The options to create the string representation for.
        lookup - a function to determine if the Option is part of an OptionGroup that has already been processed.
        Returns:
        the string representation of the options as used in the syntax display.
      • toSyntaxOptions

        public java.lang.String toSyntaxOptions​(OptionGroup group)
        Return the string representation of the options as used in the syntax display.
        Parameters:
        group - The OptionGroup to create the string representation for.
        Returns:
        the string representation of the options as used in the syntax display.
      • toSyntaxOptions

        public java.lang.String toSyntaxOptions​(Options options)
        Return the string representation of the options as used in the syntax display.
        Parameters:
        options - The Options to create the string representation for.
        Returns:
        the string representation of the options as used in the syntax display.