"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 *
> 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
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
[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:
>
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
> 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
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
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
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