Group subparser items?

50 views
Skip to first unread message

Keith

unread,
Aug 25, 2010, 1:59:39 PM8/25/10
to argparse-users
It it possible to have multiple levels? My basic goal is to get
something like this

App Name

optional arguments:
-h, --help show this help message and exit

Commands:
{adduser, deluser, listusers, foo, bar}

User Stuff:
adduser help
deluser help
listusers help

Other Things:
foo help
bar help

I would like to have something like the above, subparser works great
but visually it would be nice to be able to group the subparser items.

Thanks for any help or suggestions,

Keith

Steven Bethard

unread,
Aug 26, 2010, 5:58:58 PM8/26/10
to argpars...@googlegroups.com

There's currently no easy way to do this. Feel free to file a feature
request at bugs.python.org.

If you're adventurous, you could try fiddling around with the
undocumented formatter API. Take a look at the definition of
format_help() and you can see how groups are added. Maybe you can
massage that into doing what you want?

Steve
--
Where did you get that preposterous hypothesis?
Did Steve tell you that?
        --- The Hiphopopotamus

Reply all
Reply to author
Forward
0 new messages