Package org.rwtodd.args
Interface Param
- All Known Subinterfaces:
NoArgParam,OneArgParam
- All Known Implementing Classes:
AccumulatingParam,BasicNoArgParam,BasicOneArgParam,BoundedIntParam,ClampedIntParam,DoubleParam,EnumParam,ExistingDirectoryParam,ExistingFileParam,FlagParam,IntListParam,IntParam,StringParam
Interface for command-line parameter specs. The two subclasses
are for parameters that are expected on the command-line. One
can also define
Param instances that merely group and
format other parameters as part of help text.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddHelp(PrintStream ps) adds help for this parameter to the given stream.voidAdd the parameter's names to aMap<String,Param>.static StringformatNames(Collection<String> names) A helper function to format a list of parameter names.static voidformatTypicalHelp(PrintStream ps, String nameLine, String descline) A helper function to format a typical parameter.
-
Method Details
-
addToMap
Add the parameter's names to aMap<String,Param>.- Parameters:
map- theMapto which our names should be added.
-
addHelp
adds help for this parameter to the given stream.- Parameters:
ps- the stream to use
-
formatNames
A helper function to format a list of parameter names. It adds the appropriate number of dashes before the names, and separates them.- Parameters:
names- the collection of parameter names.- Returns:
- a formatted string
-
formatTypicalHelp
A helper function to format a typical parameter. It uses one line for the names, and an indented line for the description. Descriptions longer than 72 characters are split across lines. At present, the splitting code doesn't try to cut the lines off at word boundaries... just straight 72-length lines are used. The algorithm may improve in the future.- Parameters:
ps- thePrintStreamto write to.nameLine- the line of code for the names, perhaps generated byformatNames(Collection).descline- the description text for the parameter.
-