About
Coring is a simple command line parser for Java. The goal was to create a library that can be used to specify command line options in few lines, without much extensions. If you need more powerful library or you simply do not like this one, consider one of many alternatives (some are listed below).
Example
The following code defines three command line options (of type Boolean, Integer, and list of integers):
The following code illustrates recommended use pattern:
Features
- Fields that describe an option must be final
- Constructor requires only the name for the option (optionally, one can specify short name and/or default value)
- Help option (-h and --help) is automatically included
- @OptHelp is an optional annotation that can be used to describe an option or class
- @OptRequired is an optional annotation that marks an option that must be provided on the command line
Download
- OptExample class
- Binaries (66K) coring-1.4.jar
- Source code will be available soon under BSD license
Alternatives
There are a number of alternatives that offer different syntax and features. Consider:
Acknowledgments
I would like to thank Yu Lin, Rohan Sharma and Darko Marinov for providing feedback on the initial version of the library.