Re: optparser: how to register callback to display binary's help

2010-10-15 Thread hiral
On Oct 13, 6:03 pm, Jean-Michel Pichavant wrote: > hiral wrote: > > Hi, > > > I want to display help message of python script and then display help > > message from the binary file (which also supports -h option): > > > Assumptions: > > 1) 'mybinary' - is linux executable file which supports '-h'

Re: optparser: how to register callback to display binary's help

2010-10-13 Thread Jean-Michel Pichavant
hiral wrote: Hi, I want to display help message of python script and then display help message from the binary file (which also supports -h option): Assumptions: 1) 'mybinary' - is linux executable file which supports '-h' and on '- h' option it displays the help message 2) myscript.py - when p

Re: optparser: how to register callback to display binary's help

2010-10-13 Thread Michele Simionato
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).forma

optparser: how to register callback to display binary's help

2010-10-13 Thread hiral
Hi, I want to display help message of python script and then display help message from the binary file (which also supports -h option): Assumptions: 1) 'mybinary' - is linux executable file which supports '-h' and on '- h' option it displays the help message 2) myscript.py - when passing '-h' opt