#28 Add support for more sections than just "Options"

open
nobody
None
5
2009-10-14
2009-10-14
Boldewyn
No

Python issue #6454 (http://bugs.python.org/issue6454) states that there should be an "Examples" section, created via an "examples" keyword in the Optparse constructor.

A broader approach would be to allow *any* new group. For example, quite common in GNU man pages are sections "Examples", "Author", "Bugs", "Copyright" and so forth.

One possible way to achieve that would be a new subclass like, e.g., OptionSection:

section = OptionSection(title, description)
parser.add_section(OptionSection)

That would lead to a rendering like

Usage: example [options]
...

My Title:
My description lorem ipsum dolor sit...

Discussion