Extending help-string in optparse?
goodger at python.org
Thu Jan 23 15:28:45 CET 2003
Magnus Lie Hetland wrote:
> If I want to use cvs-like commands in addition to options with
> optparse, I can (as I was tipped about) use two (or more)
> OptionParsers to parse parts of the command line. However, it seems
> that making the --help string helpful wrt. my commands (or other
> arguments other than options, for that matter) isn't all that easy...
> Or am I missing some feature here?
You mean something like this?
python program.py subcommand --help
One might expect help for the global options as well as the subcommand's
options. Optik/optparse doesn't support this out-of-the-box, but I don't
imagine it would be that difficult to add.
On the other hand, you could simply add this to each subcommand's top-level
For help on global options, use "python program.py --help" (no
This has the advantage of keeping help output short & to the point.
-- David Goodger http://starship.python.net/~goodger
Programmer/sysadmin for hire: http://starship.python.net/~goodger/cv
More information about the Python-list