Hi there,
is possible to make own help message or attach own event on help option using optparse module in Python?
Hi there,
is possible to make own help message or attach own event on help option using optparse module in Python?
You should be able to replace the default help mechanism with your own merely by subclassing OptionParser and overriding the print_help() method.
Sure - just use the params to the OptionParser constructor:
import optparse
help_text = """
Hi, this is a really long help message for %prog.
It's a pretty ace thing. (C)2010 Stuff etc.
"""
parser = optparse.OptionParser(usage=help_text, version="%prog 1.0 beta")
(options, args) = parser.parse_args()