optparse help output

Dan thermostat at gmail.com
Wed Oct 24 11:47:15 EDT 2007


I've been using optparse for a while, and I have an option with a
number of sub-actions I want to describe in the help section:

    parser.add_option("-a", "--action",
                      help=\
"""Current supported actions: create, build, import, exp_cmd and
interact.

create   -- Vaguely depreciated, should create a new project, but it
is
            not currently suppored. First create a project in SVN,
then
            use import.

build    -- Build the project (invoking make usually).

import   -- Put the project under metaman control. Assumes that
            the current working directory is a SVN-controlled
            sandbox. Metaman checks out its own copy, does analysis
            to determine dependencies and the metadata to be
collected.

interact -- Creates a MetaMan object and starts the python interactive
            interpreter. Designed for debugging or advanced usage.
            The MetaMan object is bound to the identifier 'mm'. Only
            use this option if you know what you're doing.

exp_cmd --  add an experiment for strataman.
""")

Unfortunately, when I run the script with --help, this is what I get
for the -a option:
  -aACTION, --action=ACTION
                        Current supported actions: create, build,
import,
                        exp_cmd and interact.  create   -- Vaguely
depreciated,
                        should create a new project, but it
is             not
                        currently suppored. First create a project in
SVN, then
                        use import.  build    -- Build the project
(invoking
                        make usually).  import   -- Put the project
under
                        metaman control. Assumes that             the
current
                        working directory is a SVN-controlled
                        sandbox. Metaman checks out its own copy, does
analysis
                        to determine dependencies and the metadata to
be
                        collected.  interact -- Creates a MetaMan
object and
                        starts the python interactive
interpreter.
                        Designed for debugging or advanced usage.
                        The MetaMan object is bound to the identifier
'mm'.
                        Only             use this option if you know
what
                        you're doing.  exp_cmd --  add an experiment
for
                        strataman.

Is there any way to get the formatting I want?

-Dan




More information about the Python-list mailing list