formatting paragraphs in descriptions

"Wannheden, Knut" <[email protected]> Fri, 23 May 2003 12:30:46 +0200
Newsgroups gmane.comp.python.optik.user
Message-ID <36E996B162DAD111B6AF0000F879AD1A76C258@nts_par1.paranor.ch>
Hi!

I just converted from getopt to optik and must say I'm hooked!

Some comments:

- At first I couldn't find the command description option for the
OptionParser, as it isn't used anywhere in the basic and advanced guides.

- Optik doesn't provide any mechanisms to parse the positional arguments.  I
know this has discussed before and I've read the threads.  Maybe this could
be introduced incrementally.  To start with I think it would be nice if
Optik could check that the number of positional arguments is correct.
Currently I do this right after the parse and call OptionParser#error(msg)
if it is incorrect.

- The OptionParser#error(msg) function uses the get_prog_name() function to
determine the program name to prepend the message with.  It would be nice if
this could be set somehow.  I'd like this because I use subcommands.

But this is all just minor stuff.

Further I noticed that the HelpFormatter uses the textwrap module to format
the help messages.  textwrap is documented to work with individual
paragraphs.  I think it would be nice if the default HelpFormatter could
identify paragraphs in the command description and format these individually
and preserve the paragraphs.  Also a newline between the description and
option help would be nice.  For this purpose I implemented my own
HelpFormatter which preserves any \n\n sequences in the description and adds
a newline to the end to the description.  What do you think about this?  If
you like I could send you my code that does this, but it's really trivial
:-)  Almost forgot, my HelpFormatter does one more thing: It sets the
default width to 79 characters, as I in Windows command prompts can end up
with an empty line inside the paragraph.

Cheers,

--
knut