[Python-ideas] argparse: --help-explain [options] ...

anatoly techtonik techtonik at gmail.com
Fri Jun 21 10:10:23 CEST 2013


Inspired by QEMU:

    qemu -L . -m 128 -hda ReactOS.vmdk -net nic,model=ne2k_pci -net user
-serial file:CON

Can anybody tell what -L option does? QEMU help output is 6+ pages, and
while it is not impossible to search through the content, I guess the first
try for everybody is to try to lookup options visually. Going with every
option one by one is rather tedious.

So, the idea is that for such applications with extensive command line API,
optparse (argparse or docopt) could provide --help-explain (or just
--explain) option that parses command line and explains what it found.

    --help-explain [options] ...
    [options] ... --help-explain

The option is position-independent to append it to existing command line.


The explanation logic could be extensible, but that's a topic about state
machine of valid option combinations. I am not sure argparse allows to
manage that. However, docopt may be the saviour.
-- 
anatoly t.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130621/eb6d7a1b/attachment.html>


More information about the Python-ideas mailing list