The JCLILIB jar file (jclilib.jar) contains both source and binary files for three classes: OptionManager (manage command line options); FileLister (list files matching command line specifications, including wildcards); and Test (a small test program). Javadoc is embedded in the first two.
OptionManager provides a convenient mechanism for a console application to declare and parse command line options. The following types of options are supported:
* positional arguments (n-th argument is option value; starts at 0)
* on/off toggles
* key-value pairs (consecutive arguments, key first) -- counts as two arguments for determining position
* key~value (single string, user-selectable delimiter).
* repeated key-value pairs or key~value strings (same key, different
value each time)
If a non-positional option is encountered more than once, the last instance wins. Position numbers for positional arguments are relative to all positional arguments. In other words, positional argument 2 is the third argument encountered after skipping over all non-positional arguments
OptionManager requires declaration of default values for parameters. Parameters must be declared with (unique, case-sensitive) names, which are used to query their values.
OptionManager supports certain "wrapper classes" for parameter types, but not primitive types (to allow null values to be returned legally). Supported parameter types are Boolean, Double, Integer, Long and String (along with Object). It returns any unused/unrecognized options as an array of strings.
FileLister takes two arguments, a directory (String) and a vector of file specifications (String[]), and returns either a vector of files (File[]) or a vector of file paths (String[]) for files in the designated directory that match at least one of the file specifications. File specifications may contain glob-style wildcards (such as xyz*.txt of *.bak).
The library is released under the Apache 2.0 license by its author, Paul A. Rubin (rubin@msu.edu).