Hierarchical commnd line parsing / help texts

Gelonida N gelonida at gmail.com
Mon Sep 26 05:28:59 EDT 2011


On 09/26/2011 11:10 AM, Chris Rebert wrote:
> 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.
> 
Thanks a lot.
It seems it's time to start reading about argparse




More information about the Python-list mailing list