Package org.rwtodd.args
Class Parser
java.lang.Object
org.rwtodd.args.Parser
Parses command-line arguments against given
Params.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionparses the given args, and returns any elements that don't appear to be params in an array.parses the given args, and returns any elements that don't appear to be params in an array.voidPrint help text for each parameter given to us by the user.
-
Constructor Details
-
Parser
Construct a command-line parser from a set ofParamobjects.- Parameters:
ps- the parameters to use for parsing.
-
-
Method Details
-
parse
parses the given args, and returns any elements that don't appear to be params in an array.- Parameters:
args- the command-line argumentsskip- how many entries in args to skip before processing- Returns:
- any non-param strings from the input
- Throws:
ArgParserException- when a problem is encountered
-
parse
parses the given args, and returns any elements that don't appear to be params in an array. It skips no arguments, since in java, there is no first argument with a program name. To skip a different amount (for instance, if your command-line had subcommands to parse prior to command-line args), call the overload of this method that has 2 arguments.- Parameters:
args- the command-line arguments- Returns:
- any non-param strings from the input
- Throws:
ArgParserException- when a problem is encountered
-
printHelpText
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.
-