Package io.permazen.cli
Class ParamParser
java.lang.Object
io.permazen.cli.ParamParser
Parses command line parameters, including optional flags, based on a specification string.
The specification string contains whitespace-separated parameter specifications; see ParamParser.Param
for syntax.
Subclasses must provide the parsers for the parameter type specification names via getParser(String)
.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Represents one parsed parameter specification. -
Constructor Summary
-
Method Summary
-
Constructor Details
-
ParamParser
-
-
Method Details
-
getUsage
Build a usage summary string.- Returns:
- usage string, not including the command name
-
getOptionFlags
Get option flags.- Returns:
- optional parameters
-
getParameters
Get regular parameters, in expected order.- Returns:
- mandatory parameters
-
getParser
Convert parameter spec type name into aParser
.- Parameters:
typeName
- name of type- Returns:
- parser for parameters of the specified type
- Throws:
IllegalArgumentException
- iftypeName
is unknown
-
parse
Parse command line parameters.- Parameters:
session
- associated sessionparams
- command parameters- Throws:
ParseException
- if parse fails
-