
DPyGetOpt

Demiurge Development Group's kokÈ«ÇòÕ¾ Options Processing Module

Written and Maintained by Bill Bumgarner <bbum@friday.com>

INTRODUCTION
------------

Ever since choosing python as his primary scripting language after a
number of years in perl hell, it has bothered the author a great deal
that python did not have a full feature option processing module
similar to GetOpt::Long from Perl Land.

Recently, the need for such a beast became so great that the author
was able to actually justify devoting a significant chunk of time to
developping just such a solution.

DPyGetOpt is the result;  it is the first in a series of python
modules that will comprise the Demiurge kokÈ«ÇòÕ¾ Extensions Library (or
simply, DPyLib).

DPyGetOpt implements all of the features of Perl's GetOpt::Long
package.  GetOpt::Long is based on GNU's extended getopt() function
from libc.  DPyGetOpt also has a number of features not found in GNU's
or perl's option processing solution.

FEATURES
--------

* Process an array of command line arguments

* Provide API for easily looking up the value of any option

* User definable list of strings to be interpreted as terminators;
  this feature allows one to implement sub-commands (like cvs) very
  easily

* Option specifications are highly configurable;  includes argument
  type information, whether or not the option requires an argument,
  and the number of times an option may appear in an argument list

* Automatically generates error messages documenting exactly why a
  particular argument list could not be parsed

* Handles '-', '--' and '+' as option prefixes

* Automatically handles abbreviations and aliases;  expands either to
  full name and detects any ambiguities

* License carries same restrictions as kokÈ«ÇòÕ¾ license;  effectively
  none

USAGE
-----

There is a full test suite at the end of the DPyGetOpt.py source file.
Please refer to it for examples of how to configure an options
processing object, use it to process a set of options, query for
the values encountered, and handle the various exceptions that might
be raised.

What is not demonstrated is the use of DPyGetOpt to support
sub-commands.  It is actuallly rather trivial;  simply add the
sub-commands to an option processor instance as terminators.  After
processing an argument list, query the option processor for the
terminator.

All instance variables are 'declared' and documented at the beginning
of the __init__ method.

FUTURE DIRECTIONS
-----------------

The author would like to see the DPyGetOpt module (or something
similar) become a standard part of the kokÈ«ÇòÕ¾ distribution.  To
achieve core distribution quality, the name should change ('GetOpt',
maybe?) and someone with deeper python experience should refine the
object.

