Re: optionparse: how to add a line break to the help text

2011-09-11 Thread Robert Kern
On 9/11/11 6:05 AM, Tim Chase wrote: As Ben Finney replied, optparse is now deprecated, replaced in part by argparse. Unfortunately, argparse wasn't backported to the standard library for earlier 2.x series (I think it became available in 2.7, and may run in earlier versions if manually added li

Re: optionparse: how to add a line break to the help text

2011-09-11 Thread Gelonida N
Thanks Ben, On 09/11/2011 07:20 AM, Ben Finney wrote: > Gelonida N writes: > >> Considering, that you posted the snippet in 2007 and this is very >> probably a reocurring problem for any slighty more complicated help >> text it is really a pity, that it did not become of part of the >> standard

Re: optionparse: how to add a line break to the help text

2011-09-11 Thread Tim Chase
On 09/10/11 22:07, Gelonida N wrote: http://bytes.com/topic/python/answers/734066-how-output-newline-carriage-return-optparse It works (of course ;-) ) like a charm. Good to know, that I'm not the only one who want's to structure the help text a little nicer. Considering, that you posted the s

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Ben Finney
Gelonida N writes: > Considering, that you posted the snippet in 2007 and this is very > probably a reocurring problem for any slighty more complicated help > text it is really a pity, that it did not become of part of the > standard optparse library :-( The ‘optparse’ library is, as the online

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Gelonida N
Hi Tim, Thanks a lot!!! On 09/11/2011 04:08 AM, Tim Chase wrote: > On 09/10/11 20:54, Gelonida N wrote: >>> Unfortunately the help text is formatted using textwrap, which presumes >>> that the entire text is a single paragraph. To get paragraphs in the >>> help text, you'll need to write an I

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Tim Chase
On 09/10/11 20:54, Gelonida N wrote: Unfortunately the help text is formatted using textwrap, which presumes that the entire text is a single paragraph. To get paragraphs in the help text, you'll need to write an IndentedHelpFormatter subclass that splits the text on "\n\n", textwraps the split

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Gelonida N
Hi James, On 09/11/2011 03:12 AM, Rhodri James wrote: > On Sat, 10 Sep 2011 23:16:42 +0100, Rafael Durán Castañeda > wrote: > >> On 10/09/11 22:43, Gelonida N wrote: >>> >>> from optparse import OptionParser >>> >>> parser = OptionParser() >>> parser.add_option("-f", action="store", >>> hel

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Rhodri James
On Sat, 10 Sep 2011 23:16:42 +0100, Rafael Durán Castañeda wrote: On 10/09/11 22:43, Gelonida N wrote: I'm having a small question about optionparse. Normaly optionparser will format the help text according to the console's width. I just wondered if there is any way to insert a line breakk

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Robert Kern
On 9/10/11 5:16 PM, Rafael Durán Castañeda wrote: On 10/09/11 22:43, Gelonida N wrote: I'm having a small question about optionparse. Normaly optionparser will format the help text according to the console's width. I just wondered if there is any way to insert a line breakk into an options hel

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Rafael Durán Castañeda
On 10/09/11 22:43, Gelonida N wrote: I'm having a small question about optionparse. Normaly optionparser will format the help text according to the console's width. I just wondered if there is any way to insert a line breakk into an options help text. Example: from optparse import OptionParse