Re: [Enhancement proposal]: printing the help message

Thorsten Kampe <[email protected]> Wed, 8 Sep 2004 12:19:24 +0200
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
* Greg Ward (2004-09-07 04:17 +0200)
> On 05 September 2004, Thorsten Kampe said:
>> * Print "section" names in UPPERCASE or in "Title Case" to let the
>> user distinguish options more easily. This refers to "usage:",
>> "description:", "options:" and "%OptionGroup options:"
> 
> I consider this to be developer preference, so it should be done by
> subclassing one of the existing HelpFormatter subclasses
> (IndentedHelpFormatter or TitledHelpFormatter) and overriding the
> appropriate method (format_heading()?).  If you cannot easily do it that
> way, then HelpFormatter needs refactoring.

*I* cannot do it easily that way because I don't know about
"subclassing" and "overriding methods".

> If you can convince us with clear examples that the default really
> needs changing, then I'll consider it.

A matter of visualisation. Compare this

thorsten@galactus% ./template.py --help
usage: template.py [options] arg

description: %prog does something
options:
  --version            show program's version number and exit
  -h, --help           show this help message and exit
  -fFILE, --file=FILE  read input from FILE

  verbosity options:
    amount of status messages printed to stdout
    -v, --verbose      print status messages to stdout (default)
    -q, --quiet        don't print status messages to stdout

to this...

thorsten@galactus% ./template.py --help
USAGE: template.py [options] arg

DESCRIPTION: %prog does something

OPTIONS:
  --version            show program's version number and exit
  -h, --help           show this help message and exit
  -fFILE, --file=FILE  read input from FILE

  Verbosity Options:
    amount of status messages printed to stdout
    -v, --verbose      print status messages to stdout (default)
    -q, --quiet        don't print status messages to stdout
 
>> * make an enhancement to use coloured output in help messages
> 
> Blecch.  Feel free to implement this yourself, but you'll only get it
> into Optik over my dead body, *or* if I am flooded by people who really
> really want this feature.  In my experience, "coloured output" ==
> "illegible output"; disabling colour ls is one of the first things I do
> when setting up a new Red Hat system, and it's one of the things I've
> always hated about Red Hat.

Decent colour can improve legibility; if you colourize /all/ output
(or most of) legibility will even decrease. Consider this:

* Dangerous Options:
    dangerous options likely to destroy everything
    -d, --dangerous
    -v, --very-dangerous

"* Dangerous Options:" printed in red will make the "dangerousness"
more obvious.
 
> If you can implement it with a custom HelpFormatter, case closed; if
> HelpFormatter needs refactoring to support this level of customization,
> let me know and we'll see what I can do.

My Python Object Oriented skills are not that way that I could
implement this myself.

Thorsten



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click