Re: FileOptionParser and DefaultOption

Greg Ward <[email protected]> Thu, 28 Jul 2005 20:02:50 -0400
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
[Dirk Groeneveld]
> As part of a bigger project I wrote an OptionParser class that reads
> option defaults from a configuration file (in the ConfigFile way). The
> configuration file itself is another command line option. Normal defaults
> are still supported as before, so the order of precedence becomes
> defaults, configuration file (if given), command line options, from low to
> high.

It's funny, I've never felt a burning need to unify Optik with config
file parsing.  I *have* felt a powerful need for a better config file
library in Python, it's just that I've never been tempted to hijack
Optik for that purpose.  Not sure what my reservation is, since a lot of
the work that Optik does is relevant to config files.  Must be some
atavistic "do one thing and do it well" urge.

> My question is if you would consider including this class into the
> mainstream optik distribution. In that case I'd create some more
> documentation and make a patch ... and replace tabs with spaces ;-)

Well, since that's my job rather than Dan's, perhaps you should post the
source to optik-users.  Or file a patch against Optik on SourceForge.
But keep the above paragraph in mind!

> As part of the same project I also wrote a class that automatically adds
> information about a default to an option to the help text of that option.
> For example,

That's already been done in Optik 1.5 (Python 2.4).  It's documented in
the tutorial.

> You may be interested in reading some discussion on your "marriage" between 
> command line option parsing and configuration file parsing on the 
> configuration shootout page: 
> http://wiki.python.org/moin/ConfigParserShootout.

Wow, I had no idea there had been so much interest in this.  I'd better
go write my own config parsing library, quick!  ;->

        Greg
-- 
Greg Ward <[email protected]>                         http://www.gerg.ca/
A committee is a life form with six or more legs and no brain.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf