Class OptionCollection

java.lang.Object
org.apache.rat.OptionCollection

public final class OptionCollection extends Object
The collection of standard options for the CLI as well as utility methods to manage them and methods to create the ReportConfiguration from the options and an array of arguments.
  • Field Details

    • OPTION_COMPARATOR

      public static final Comparator<org.apache.commons.cli.Option> OPTION_COMPARATOR
      The Option comparator to sort the help
    • HELP

      public static final org.apache.commons.cli.Option HELP
      The Help option
    • HELP_LICENSES

      public static final org.apache.commons.cli.Option HELP_LICENSES
      Provide license definition listing
  • Method Details

    • getArgumentTypes

      public static Map<String,Supplier<String>> getArgumentTypes()
      Gets the mapping of argName(value) values to a description of those values.
      Returns:
      the mapping of argName(value) values to a description of those values.
    • parseCommands

      public static ReportConfiguration parseCommands(File workingDirectory, String[] args, Consumer<org.apache.commons.cli.Options> helpCmd) throws IOException
      Parses the standard options to create a ReportConfiguration.
      Parameters:
      workingDirectory - The directory to resolve relative file names against.
      args - the arguments to parse
      helpCmd - the help command to run when necessary.
      Returns:
      a ReportConfiguration or null if Help was printed.
      Throws:
      IOException - on error.
    • parseCommands

      public static ReportConfiguration parseCommands(File workingDirectory, String[] args, Consumer<org.apache.commons.cli.Options> helpCmd, boolean noArgs) throws IOException
      Parses the standard options to create a ReportConfiguration.
      Parameters:
      workingDirectory - The directory to resolve relative file names against.
      args - the arguments to parse
      helpCmd - the help command to run when necessary.
      noArgs - If true then the commands do not need extra arguments
      Returns:
      a ReportConfiguration or null if Help was printed.
      Throws:
      IOException - on error.
    • buildOptions

      public static org.apache.commons.cli.Options buildOptions()
      Create an Options object from the list of defined Options. Mutually exclusive options must be listed in an OptionGroup.
      Returns:
      the Options comprised of the Options defined in this class.