A couple of minor patches

Zippy the Wonder Idiot <[email protected]> Mon, 29 Aug 2005 10:05:33 -0700 (PDT)
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
Hi!  I'm new here, but I wanted to point out a couple of minor patches I'=
ve posted to the
project's SourceForge page.  They implement a couple of little things I f=
ound myself wishing for
when I started working with Optik for the first time the other day and th=
ought others might
appreciate.  The patches both apply to the HelpFormatter base class, but =
leave the default
behavior alone for backwards compatibility.

The first patch adds a "preserve_whitespace=3D" argument to __init__(), w=
hich does what it says.=20
The default for the textwrap functions is "replace_whitespace=3DTrue", wh=
ich destroys tabs and
newlines; setting "preserve_whitespace=3DTrue" on any HelpFormatter will =
reverse this.  I see from
the list archives that this has been discussed before, but that a differe=
nt solution was devised.=20
I'll leave it to wiser heads than mine to determine which is better.  :-)

The first patch also adds a SUPPRESS_METAVAR special value for metavar=3D=
 on options, which causes
the option to be displayed as if it didn't consume arguments.  Mostly, th=
is is for options with
nargs > 1, as "--long-option=3DARG1 ARG2" looks funky; I'd rather explain=
 it myself in the help
text.

Lastly, the second patch enables the expansion of %prog in option help te=
xt, assuming the
HelpFormatter's parser is set.  The logic for this is identical to that u=
sed in expand_default(),
so I've co-opted that into expand(), which performs both.

As I said, it's just little stuff, but maybe others will find some of it =
similarly useful.

--=20
Dark

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around=20
http://mail.yahoo.com=20


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