Re: An optparse question

2006-07-21 Thread John J. Lee
"T" <[EMAIL PROTECTED]> writes: [...] > What I would like to do is insert some string *before* the "usage = " > string, which is right after the command I type at the command prompt. > So I would like to make it look like this: > > % myprog.py -h > THIS IS NEWLY INSERTED STRING *

Re: An optparse question

2006-07-21 Thread dan . gass
> Nope. That only *nearly* does what T wants. The usage message will > still be printed immediately *after* the 'usage: ' string. > > >>> parser = OptionParser(usage=usage) > >>> parser.print_help() > usage: THIS IS NEWLY INSERTED STRING > usage: lopts.py [options] input

Re: An optparse question

2006-07-21 Thread Steve Holden
T wrote: > fuzzylollipop wrote: > >>you can make the usage line anything you want. >> >>... >>usage = 'This is a line before the usage line\nusage %prog [options] >>input_file' >>parser = OptionsParser(usage=usage) >>parser.print_help() >>... >> > > > No, that affects the string printed only *af

Re: An optparse question

2006-07-21 Thread Simon Forman
[EMAIL PROTECTED] wrote: > > No, that affects the string printed only *after* the "usage = " string. > > What I would like to do is insert some string *before* the "usage = " > > string, which is right after the command I type at the command prompt. > > So I would like to make it look like this: >

Re: An optparse question

2006-07-21 Thread Simon Forman
T wrote: > fuzzylollipop wrote: > > > > you can make the usage line anything you want. > > > > ... > > usage = 'This is a line before the usage line\nusage %prog [options] > > input_file' > > parser = OptionsParser(usage=usage) > > parser.print_help() > > ... > > > > No, that affects the string pri

Re: An optparse question

2006-07-21 Thread dan . gass
> No, that affects the string printed only *after* the "usage = " string. > What I would like to do is insert some string *before* the "usage = " > string, which is right after the command I type at the command prompt. > So I would like to make it look like this: The example was fine (except for

Re: An optparse question

2006-07-21 Thread T
fuzzylollipop wrote: > > you can make the usage line anything you want. > > ... > usage = 'This is a line before the usage line\nusage %prog [options] > input_file' > parser = OptionsParser(usage=usage) > parser.print_help() > ... > No, that affects the string printed only *after* the "usage = " s

Re: An optparse question

2006-07-21 Thread fuzzylollipop
T wrote: > I have a short program using optparse.OptionParser that prints out help > message with -h flag: > > % myprog.py -h > usage: myprog.py [options] input_file > > options: > -h, --help show this help message and exit > -v, --verboseprint program's version number and

An optparse question

2006-07-21 Thread T
I have a short program using optparse.OptionParser that prints out help message with -h flag: % myprog.py -h usage: myprog.py [options] input_file options: -h, --help show this help message and exit -v, --verboseprint program's version number and exit -o FILE