Hierarchical commnd line parsing / help texts

Chris Rebert clp2 at rebertia.com
Mon Sep 26 11:10:17 CEST 2011


On Mon, Sep 26, 2011 at 1:55 AM, Gelonida N <gelonida at gmail.com> wrote:
> Hi,
>
> So far I used optparse.OptionParser for parsing command line arguments
> for my python scripts. So far I was happy, with a one level approach,
> where I get only one help text
>
> Now I'd like to create a slightly different python script and wondered
> which approach / module might be best for implementing the parsing and
> generation of help texts.
<snip>
> then if I typed ./sh.py <command> -h
> I'd like to get the helptext for the specified command.

http://docs.python.org/library/argparse.html

It is capable of handling sub-commands and the display of
subcommand-specific help text.

Cheers,
Chris



More information about the Python-list mailing list