Alex Rivera | Logout

How do I format positional argument help using Python's optparse?

Asked 2009-03-13T13:16:56.647
27

As mentioned in the docs the optparse.OptionParser uses an IndentedHelpFormatter to output the formatted option help, for which which I found some API documentation.

I want to display a similarly formatted help text for the required, positional arguments in the usage text. Is there an adapter or a simple usage pattern that can be used for similar positional argument formatting?

Clarification

Preferably only using the stdlib. Optparse does great except for this one formatting nuance, which I feel like we should be able to fix without importing whole other packages. :-)

Edit
Report

1 Answer

8

Try taking a look at argparse. Documentation says it supports position arguments and nicer looking help messages.

answered 2009-03-13T17:34:22.503

Your Answer