Maintainer
Paul Cohen
Description
ECLOP (the Eiffel Command-Line Option Parser) is a small set of Eiffel classes for parsing command line options.
It provides Eiffel programmers with:
- A compact way of specifying valid command line options and a number of properties of the options, such as whether they are required or not, whether they take arguments or not and whether they are mutually exclusive or not.
- An easy way to parse given command line arguments as well as an easy to use interface for checking that all parsed command line arguments are valid options or option arguments and for accessing the parsed options and their arguments.
- Ready to use program invocation error messages as well as messages with information on program usage and program help.
The intention is that ECLOP will support all the features of the POSIX and GNU getopt function and also the POSIX Utility Conventions. This is not entirely true of ECLOP 0.1.0, and ECLOP also has features that are not supported by the getopt function.
Categories
Versions
Features
ECLOP consists of six Eiffel classes of which two (COMMAND LINE SYNTAX and COMMAND LINE PARSER) are intended for use by clients of the ECLOP library. Using ECLOP typically consists of going through the following steps:
- Create a number of STRING based option specifications and put them in an ARRAY [STRING].
- Create an instance of COMMAND LINE SYNTAX and supply it with the ARRAY [STRING].
- Create an instance of COMMAND LINE PARSER and supply it with your COMMAND LINE SYNTAX object. If the COMMAND LINE SYNTAX is invalid because it was provided an invalid option specification or inconsistent option specifications the COMMAND LINE PARSER will raise a precondition violation.
- Tell your COMMAND LINE PARSER object to parse the ARRAY [STRING] of actual program arguments that your program was invoked with (see the ISE Eiffel class ARGUMENTS).
- Query your COMMAND LINE PARSER object to see if all parsed program arguments were valid. If not, ask the COMMAND LINE PARSER object for an error message to present to the user.
- If all the parsed program arguments were valid you can access them and any associated option arguments via the feature valid_options in the class COMMAND LINE PARSER.
Examples and extensive documentation are included in the distribution.
Supported compilers
Platforms
- Windows (should work on Linux too)
Licensing
Packages using ECLOP