Here is a solution using plac (http://pypi.python.org/pypi/plac) and
not OptionParse, in the case
the Linux underlying command is grep:
import subprocess
import plac
@plac.annotations(help=('show help', 'flag', 'h'))
def main(help):
if help:
script_usage = plac.parser_from(main).format_help()
po = subprocess.Popen(['grep', '-h'], stderr=subprocess.PIPE)
grep_usage = po.stderr.read()
print script_usage
print grep_usage
main.add_help = False
if __name__ == '__main__':
plac.call(main)
--
http://mail.python.org/mailman/listinfo/python-list