This site's content was compiled from 1993 to 2006. Beyond that, Google is your friend.
Bernd Schoeller
A library for parsing command line options in Eiffel. It makes it easy to add full-featured command line parsing to any Eiffel application.
Discontinued. This project has now been incorporated into the Gobo project.
To parse the command line, create an instance of OP_PARSER and call 'parse_arguments'. Parsing any other list of strings as arguments can be done using 'parse_list'.
For every option, you must first create an option object and add it to the parser. There are multiple option classes, depending on whether you want to pass parameters to the options or not.
class OP_EXAMPLE create main feature -- Main main is -- Main routine local parser: OP_PARSER flag: OP_FLAG option: OP_INTEGER_OPTION do -- First we create the parser create parser.make -- We add a flag create flag.make ('f',"flag") flag.set_description ("A simple flag") parser.extend (flag) -- We add an integer option create option.make ('o',"option") option.set_description ("An integer option. You have to supply an"+ " integer value to this option to be parsed correctly.") parser.extend (option) -- We parse the arguments parser.parse_arguments -- Lets see what we found if flag.was_found then print ("The user has activated the flag.%N") end if option.was_found then print ("The user has supplied the option with "+option.value.out+"%N") end print ("The number of parameters were "+parser.parameters.count.out+"%N") end end