Class Parser

java.lang.Object
org.rwtodd.args.Parser

public class Parser extends Object
Parses command-line arguments against given Params.
  • Constructor Details

    • Parser

      public Parser(Param... ps)
      Construct a command-line parser from a set of Param objects.
      Parameters:
      ps - the parameters to use for parsing.
  • Method Details

    • parse

      public List<String> parse(String... args) throws ArgParserException
      parses the given args, and returns any elements that don't appear to be params in an array.
      Parameters:
      args - the command-line arguments
      Returns:
      any non-param strings from the input
      Throws:
      ArgParserException - when a problem is encountered
    • printHelpText

      public void printHelpText(PrintStream ps)
      Print help text for each parameter given to us by the user. The parametrs are printed in the same order they were provided.
      Parameters:
      ps - the print stream to use for output.