1.0 (11 Nov 2001) ----------------- * First public release 1.1 (17 Nov 2001) ----------------- * Changed OptionParser.parse_args() method to allow interspersed options and positional arguments by default; can be disabled with disable_interspersed_args() method. Reorganized the guts of the OptionParser class fairly heavily. * Split test_optik.py up into three scripts (test_optik, test_callback, and test_extend), and moved them all into the test/ directory. * Added the 'nargs' attribute to Option, which allows options to require more than one argument on the command line. This enables eg. parser.add_option("-p", "--point", action="append", nargs=3, type="float", dest="points") to turn a command-line like this: --point 3.4 -5 95 -p 4 -4 6 into this: options.points == [(3.4, -5.0, 95.0), (4.0, -4.0, 6.0)] * Fixed so the last default value explicitly specified for a particular option destination takes precedence, even if it's None. 1.1.1 (28 Nov 2001) ------------------- * Various documentation tweaks (thanks to Alan Eldridge for prodding me into those, and for doing most of one). * Fixed a bug that prevented users from doing things like -f"" or --file="" on the command-line. Involved rewriting some hairy code in OptionParser, which has the pleasant side-effect that the first argument to an option with multiple arguments can now be jammed up against the option, eg. "-p3 5 1". 1.2 (18 Dec 2001) ----------------- * Fixed how bare "--" and "-" are handled for consistency with GNU getopt. Note that this affects how callbacks that consume arguments should be implemented; see callbacks.txt for details. Thanks to Matthew Mueller for the patch. * Added 'version' argument to OptionParser constructor; if present, Option automatically adds a --version option to your option parser. 'version' is a string that is expanded in the same way as 'usage', ie. "%prog" is replaced by the program name. * Added several methods to OptionParser that let you query/manipulate the list of options: has_option(), get_option(), remove_option(). * Added detection and handling of option conflicts. Eg. if you define two options with a "-v" option string, the default is now to raise an exception; the old behaviour was to ignore the conflict. A third way to handle conflicts is to resolve them in favour of the last option added. * Added separate documentation for callback options in callback.txt, and removed most callback documentation from advanced.txt. * Split the overgrown test_optik.py script up into test_{basics,bool,count,nargs,misc}.py, and added a shell script (test/runall) that will run all tests in one go. 1.3 (11 Apr 2002) ----------------- * Fixed a couple of lurking bugs found by PyChecker. * You can now get away with not supplying an option's type, no matter the action: Optik now assumes a default type of "string". * You can now get away with not supplying an option's destination: Optik now derives a default destination from the first long option, or the first short option if no long options were given. Eg. an option string "--foo-bar" has the default destination 'foo_bar'. * Refactored both Option's and OptionParser's constructors to make life easier for people extending Optik. * Added the "examples/" subdirectory -- this is a repository of examples of extending and using Optik; the goal is to provide canonical implementations of various features that I don't want to add to Optik proper, but that are occasionally requested. (Also, this gives me a good place to test Optik's extensibility.) * Added support for long and complex option types, mainly for completeness (patch by Matthew Mueller). * Added make_option() as an alias for the Option constructor, because someday there might be many Option classes (in which case make_option() will become a factory function). 1.4 (12 Oct 2002) ----------------- [editorial note: most significant code changes in Optik 1.4 were made by David Goodger; except as noted below, David should be credited with everything in this list! I just rearranged some of his changes, renamed a few thing, and put out the release. --Greg] * Factored the help-formatting code out of OptionParser into some new classes (HelpFormatter and subclasses) in help.py. This should make it a lot easier to customize how help is formatted. * Added the notion of "option groups": an OptionParser can now contain several option groups, each which contains several options. The main purpose of this is to enable sensibly-grouped help output, but it opens up all sorts of interesting (and largely untested) possibilities for code to throw whole option groups around instead of individual options. Added two new classes: OptionGroup, and OptionContainer for code common to OptionParser and OptionGroup. (OptionContainer should be invisible to programmers using Optik). * Added the 'description' attribute and set_description() method to both OptionParser and OptionGroup (actually OptionContainer, but I just said that class was invisible). Again, this is to make help output more useful. * Made it easier for OptionParser subclasses to decide whether they should have the standard "help" option, by moving the logic from class level to the _populate_option_list() method. * Added the "choice" option type, which is just a string type constrained to a fixed set of values. * Added method get_default_values() to OptionParser. * Rewrote how OptionParser recognizes abbreviated long options; removed a redundant internal instance attribute. * Simplify parsing logic in OptionParser a tad by relocating a loop and renaming _process_arg() to _process_args(). 1.4.1 (20 Apr 2003) ------------------- * Changed to use the new textwrap module included with Python 2.3. Includes a copy of textwrap.py for use with older Python versions. * Set __all__ in each of the optik.* modules, to make life easier for optik/__init__.py. * Rewrote the test suite to use PyUnit, and added some new tests that revealed some long-hidden bugs. Fixed those bugs. (Thanks to Johannes Gijsbers for doing all the work!) * For versions of Python with builtin True and False values (ie. Python 2.2.1 and later), make store_true/store_false use them. * Add forwards-compatibility 'optparse' module, so scripts can import from 'optparse' and work under base Python 2.3, or under older Pythons with Optik 1.4.1 or later installed.